We, the authors of the SharePoint Code Analysis Tools, are creating applications on the SharePoint plattform as project managers, architects or developers since many years. From the beginning we were facing several challenges in SharePoint development:
  • Missing automation in deployment process
  • Tons of XML code for SharePoint elements
  • Developing by "copy & paste"
  • Missing code quality checks
  • Missing guidance and best practices

So we decided to change this and started to make development for SharePoint easier with the SharePoint Software Factory. SPSF contains lots of templates and recipes to automate the creation of SharePoint code. It helps to improve speed in development and helps to develop code according to SharePoint best practices. It helps newbies to learn SharePoint development faster and project managers and architects to reach a higher level of code quality in their team. It contains project templates which support the Team Foundation Server Team Build and therefore enable the first step of ALM for SharePoint.

Next critical step in SharePoint development was the deployment of the custom solutions. So we integrated the automation of the deployment process into the SharePoint Software Factory, with configurable XML scripts and MSBuild. After SharePoint 2010 shifted from STSADM/SSOM to PowerShell, we decided to rebuild the deployment scripts from scratch based on Powershell and made it also available as the separate SharePoint Solution Deployer project on Codeplex at.

Now SharePoint development became easier for the developers and the deployment process became stable, reproducable and highly automated. But one piece was missing all the time: the code quality checks. Nobody was able to check the correctness of SharePoint code and conformance to best practices. Errors in the XML code (like typos or more critical errors) could only be found during runtime after deployment. This usually costs time and money and nervs. Unfortunately existing tools like FxCop or others are not able to check the XML part of SharePoint code or any SharePoint specific practices.

So we started to develop SPCop: A tool to analyze SharePoint solution packages (.wsp) including assemblies and XML code. We ended up with more than 300 rules which can check custom SharePoint code for correctness, best practices, design, naming, supportability etc. SPCop is available as extension for Visual Studio, as command line tool or a build activity for your Team Build in TFS. And SPCop provides a SDK to create your own rules.

But this was not the end. Our approach of extracting SharePoint WSP solutions and making them analyzable opened new opportunities: with all the SharePoint code in our hands we were also able to analyze all dependencies between SharePoint elements like FeatureActivation dependencies, referenced images, referenced Fields in ContentTypes. We were able to calculate Code Metrics e.g. Number of features in the code. And we were able to create an inventory of all code in WSP solution packages. The dream for every SharePoint code reviewer, architect and administrator.

So, today the SharePoint Code Analysis Framework (SPCAF) is the home of these new SharePoint code analysis tools:

  • SPCop for validation of more than 300 rules
  • SPDepend for creation of dependency graph
  • SPMetrics for calculation of SharePoint code metrics
  • SPInventory for creation of an code inventory
Use the tools for your SharePoint custom code and improve the overall quality.

And now comes the best: SPCop is available for free and can be used by every developer. Download SPCop in Visual Studio Gallery.

comments powered by Disqus