
Each SharePoint developer uses different tools to check the code, for example, it can be a combination of StyleCop and SPDisposeCheck.
This article will
discuss the SharePoint Code Check (SPCop) - a SharePoint code analyzer that is a free version of the
SharePoint Code Analysis Framework (SPCAF) .
List of some features:
- The ability to identify errors in XML before deploying the solution in SharePoint and subsequent testing
- Easier to follow best practices and learn to develop solutions for SharePoint
- Code Analysis in SharePoint Context
- Ability to expand the list of rules for SPCop / SPCAF . For example, on CodePlex there is a good project SPCAFContrib
- Integration with Visual Studio 2010, 2012, 2013
- More than 300 code analysis rules (list can be found here )
')
In the future, SPCop developers plan to expand the list of rules for analyzing SharePoint applications (apps) in order to improve the process of their creation.
Clarification: Additional features such as HTML, XML reports, third-party parsers for CSS and JavaScript, dependencies, client applications and integration with TFS Team Build / TeamCity are only available in the paid version of the
SharePoint Code Analysis Framework (SPCAF) .
What about SPDisposeCheck?
The latest version of
SPDisposeCheck was released in 2010, and was intended for SharePoint 2010. As you understand, SPDisposeCheck is based on the .NET Framework 3.5. And now, at the time of SharePoint 2013, there may be some difficulties with analyzing assemblies based on the .NET Framework 4.5. If SPDisposeCheck does not show errors for your project for SharePoint 2013, it is better to check it again with SPCop.
In addition, many of the rules SPDisposeCheck caused false positives or simply outdated. Therefore, a special “
Memory Disposal ” rule set has been added to SPCop.
Integration with Visual Studio
A special section will appear in the context menu of SharePoint projects.

After starting the analysis, you can understand the current state of your decision.

As you can see, SPCop not only allows you to find potential problems in your code before deploying solutions, but also helps you write more stable and correct code.
Links
SharePoint Code Check (SPCop) in Visual Studio Gallery
SPCop Documentation