Automated Code Quality Analysis of SharePoint Solutions


Published on

These are my slides from the ShareCamp2013 in Munich http;//

SharePoint development and fun do not always have much in common! Everyone who has ever developed for SharePoint in Visual Studio might know what I mean. Even a small SharePoint solution consist already of a large amount of different files (xml, cs, js, css, resx, jpg, aspx, etc) which may be structured differently depending on the preferences and experience of the developer.
Particularly the extensive XML Schema for manifest.xml, feature.xml, element.xml, Content Types, List Definitions, etc. is an endless source of surprise and cannot be debugged at all in Visual Studio. As a way out, many developers choose to develop standard SharePoint artefacts programmatically rather than following the declarative approach which make the solutions even more complex.
As a result it is really hard to analyze SharePoint solutions, find violations against the XML schema, best practices, coding guidelines or to pinpoint performance sinks and cyclomatic dependencies of artefacts.
Neither Visual Studio nor other tools like FXCop, StyleCop etc. allow to perform SharePoint specific automatic code analysis.
This session will show the SharePoint Code Analysis Framework (SPCAF) which addresses exactly this gap and you will learn how to easily develop your own rules for it.
SPCAF is available at

Published in: Technology
  • Be the first to comment

Automated Code Quality Analysis of SharePoint Solutions

  1. 1. Matthias EinigSharePoint Architect SharePoint developer since 2005Steria AB, www.steria.comStockholm, Sweden MCSE, MCPD, MCITP MSCA in , SharePoint 2007-2013 SCRUM Master and Product OwnerContact Main Focus:@mattein • Solution Architecture, • Solution Development, • SharePoint ALM, • Solution Quality Assurance
  2. 2. Why SharePoint Code Analysis? SharePoint solutions are complex Solutions change (ALM) Solution quality differs Ensure maintainability Assure farm stability/security/licensing Maintain policies/best practices/support
  3. 3. What can we analyse how?Assemblies FxCop / VS CA Checks against general coding errors (not SharePoint-specific) FxCop Metrics Calculates code metrics (only .net code, not SharePoint sepcific) Analyzes code security (not SharePoint-specific)SourceCode StyleCop Checks coding style guidelinesSP Code SPDisposeCheck Checks memory leaks (SharePoint-specific) MSOCAF Combination of FxCop and SPDisposeCheck for SharePoint Online
  4. 4. Problem… The Solution! SP CAF SharePoint Code Analysis Framework
  5. 5. Components of SPCAF SP Cop SP Depend SP Metrics SP Inventory Identifies coding Visualizes Calculates metrics Creates content violations against dependencies on SharePoint Code reports of packages ~400 rules between SharePoint elements
  6. 6. SPCAF supports
  7. 7. ContentSPCAF analyses the entireWSP package
  8. 8. SP CAF
  9. 9. Configure Rulesets • Information • Warning • Error
  10. 10. Run SPCAF in TeamBuild as Quality Gate• Custom Build Activity• Supports TFS 2010/2012 and Team Foundation Service (Cloud) Build in TFS on premise Build in Team Foundation Services
  11. 11. • SPCAF runs on Azure (WCF Service)• Available Clients: Windows 8 App Desktop Client (WPF) Web Client (Silverlight) SPCAF on Azure
  12. 12. SP CAF
  13. 13. Where do I get it? Follow us! The SharePoint Code Quality Team Torsten Mandelkow @tmandelkow Matthias Einig @mattein
  14. 14. Analyse SP Code... Run SPCAF... Customize SPCAF...... for rule violations ... in Visual Studio ... with custom rules (SDK)... for dependencies ... on Command Line ... with custom settings... for metrics ... in Team Build... for inventory information ... on Azure Free BETA available now at