R# is a productivity and refactoring tool for C# development, SPCAF is a code quality analysis tool specifically designed for SharePoint customizations.
Apart from acting as a quality tool for the developer on his local machine like R#, SPCAF can be used also as a quality gate for the architect e.g. in a Team Build and as the documentation tool for the infrastructure expert.
R# has no understanding of how SharePoint solutions work, how they are assembled together and how SharePoint deploys them into the farm or your SharePoint Online tenant.
Further, on the contrary to SPCAF, you always require the source code for R#. This makes it impossible to analyze anything which is generated during packaging of the web solution package (WSP) or the app, eg. deployment locations, dependencies, feature.xml, manifest.xml etc.
R# cannot analyze code violations which happen between multiple files, eg. a custom content type is referenced in a class but is configured falsely in the declarative content type .xml file.
SPCAF currently consists of five main analysis components:
- Code Metrics calculates 80 SharePoint-specific code metrics to measure the complexity of the code and track changes.
- Code Dependencies reports 63 dependency types between the SharePoint artifacts (like Features, Content Types etc.) external components.
- Code Inventory creates a detailed documentation of 46 components in the SharePoint packages and apps.
- Migration Assessment provides guidance how to migrate your SharePoint farm solution to the App model based on the information gathered by all the modules
SPCAF does not run on the fly while development. You have to initiate the analysis manually which will build and package your solution. This is necessary to be able to analyze the whole solution as it will be seen by SharePoint and provide the ability to analyze dependencies within the WSP and between multiple solutions analyzed together. As this analysis takes some time, an on the fly analysis like R# would gravely disturb the developer's workflow.
SPCAF runs not only in Visual Studio, but also as a stand-alone application which does not require the source code at all. Additionally, there is also SPCAF Quality Gate which integrates into a TFS or TeamCity Team Build eg. for a continuous integration process in a development team.