Your SlideShare is downloading. ×
0
SPSOslo: Automated code quality analysis of SharePoint solutions
SPSOslo: Automated code quality analysis of SharePoint solutions
SPSOslo: Automated code quality analysis of SharePoint solutions
SPSOslo: Automated code quality analysis of SharePoint solutions
SPSOslo: Automated code quality analysis of SharePoint solutions
SPSOslo: Automated code quality analysis of SharePoint solutions
SPSOslo: Automated code quality analysis of SharePoint solutions
SPSOslo: Automated code quality analysis of SharePoint solutions
SPSOslo: Automated code quality analysis of SharePoint solutions
SPSOslo: Automated code quality analysis of SharePoint solutions
SPSOslo: Automated code quality analysis of SharePoint solutions
SPSOslo: Automated code quality analysis of SharePoint solutions
SPSOslo: Automated code quality analysis of SharePoint solutions
SPSOslo: Automated code quality analysis of SharePoint solutions
SPSOslo: Automated code quality analysis of SharePoint solutions
SPSOslo: Automated code quality analysis of SharePoint solutions
SPSOslo: Automated code quality analysis of SharePoint solutions
SPSOslo: Automated code quality analysis of SharePoint solutions
SPSOslo: Automated code quality analysis of SharePoint solutions
SPSOslo: Automated code quality analysis of SharePoint solutions
SPSOslo: Automated code quality analysis of SharePoint solutions
SPSOslo: Automated code quality analysis of SharePoint solutions
SPSOslo: Automated code quality analysis of SharePoint solutions
SPSOslo: Automated code quality analysis of SharePoint solutions
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

SPSOslo: Automated code quality analysis of SharePoint solutions

1,435

Published on

This presentation was held at the SharePoint Saturday Oslo, 1st of June 2013 …

This presentation was held at the SharePoint Saturday Oslo, 1st of June 2013
http://spsevents.org/worldwide/Oslo/Pages/Oslo.aspx

Title: Automated Code Quality Analysis of SharePoint Solutions
Synopsis:
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 artifacts 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, ensure best practices, enforce coding guidelines or pinpoint performance sinks and cyclomatic dependencies of artifacts.
Neither Visual Studio nor other tools like FXCop, StyleCop etc. allow you to perform a SharePoint specific static code analysis.
This session will highlight the challenges when analyzing SharePoint code and shows a solution by demoing the SharePoint code analysis framework (SPCAF) (www.spcaf.com) which addresses this gap. Additionally you will learn how easy SPCAF can be extended by developing your own custom rules.

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,435
On Slideshare
0
From Embeds
0
Number of Embeds
6
Actions
Shares
0
Downloads
0
Comments
0
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. @mattein #SPCAFAutomated Code Quality Analysisof SharePoint Solutions#spsosloMatthias EinigJune 1st, 2013
  • 2. @mattein #SPCAFThanks to ourSponsorsPlatinumGoldSilver
  • 3. @mattein #SPCAFContact@matteinmail@matthiaseinig.dewww.matthiaseinig.deMatthias EinigSharePoint developer since SPS2003MCSE, MCPD, MCITP, MSCA inSharePoint 2007-2013SCRUM Master and Product OwnerSharePoint ArchitectSteria AB, www.steria.comStockholm, SwedenMain Focus:• Solution Architecture,• Solution Development,• SharePoint ALM,• Solution Quality Assurancesharepoint-community.net
  • 4. @mattein #SPCAFWhat is Code Analysis? Static vs. Dynamic Source Code vs. Object Code Manual vs. Automated Coding Errors, Best Practices Metrics
  • 5. @mattein #SPCAFWhy is it so important for SharePoint? Solutions / apps are black boxes Code quality differs a lot Solutions change (ALM) Complexity complicatesmaintainability Farm stability / security / licensing needs to be assured Policies / best practices are hard to enforce
  • 6. @mattein #SPCAFSo, what the heck is SharePoint Code? .NET code using SP API XML Files: Manifest, Features,Content Types, Web Templates HTML, ASPX, ASCX CSS, JavaScript Resources: images, resx, document templates… Deployment locations!
  • 7. @mattein #SPCAFWho needs it and why?Is my codecorrect and followsbest practices?DeveloperWill the codeharm my farm?AdministratorIs the codewell designed andmaintainable?ArchitectDoes the codecomply withcompany policiesand standards?Quality Manager
  • 8. @mattein #SPCAFWhat do we have right now?ObjectCode FxCop / VS CAFxCop MetricsCAT.netSourceCode StyleCopSPCode SPDisposeCheckMSOCAFChecks against general coding errors(not SharePoint-specific)Calculates code metrics(only .NET code, not SharePoint specific)Checks coding style guidelines(only .NET code, not SharePoint specific)Analyses code security(not SharePoint-specific)Checks memory leaks(SharePoint-specific)Combination of FxCop andSPDisposeCheck for SharePoint Online
  • 9. @mattein #SPCAFThe Gap… No tool to check all SharePoint specific Code Analyze solution dependencies Calculate SharePoint metrics Show what’s inside the solution / app!
  • 10. @mattein #SPCAFThe Solution!
  • 11. @mattein #SPCAFWhat is in it?Identifies codingviolations against~400 rulesVisualizesdependenciesbetween SharePointelementsCalculates metricson SharePoint CodeCreates contentreports of packages
  • 12. @mattein #SPCAFSPCAF 4 Visual Studio• Run SPCAF manually or on solution build• Doubleclick results in Error List to openthe line of code
  • 13. @mattein #SPCAF• Information• Warning• ErrorConfigure Rulesets
  • 14. @mattein #SPCAFContinuous IntegrationRun SPCAF in TeamBuild as Quality Gate• Custom Build Activity• Supports TFS 2010/2012 and Team Foundation Service (Cloud)Build in TFS on-premises Build in Team Foundation Services
  • 15. @mattein #SPCAFClient Applications• SPCAF runs on Azure (WCF Service)• Available Clients:Windows 8 App Desktop Client (WPF) Web Client (Silverlight)SPCAF on Azure
  • 16. @mattein #SPCAFSPCAF Desktop/Online
  • 17. @mattein #SPCAFusing SPCAF.Sdk;using SPCAF.Sdk.Rules;using SPCAF.Sdk.Model;using SPCAF.Sdk.Model.Extensions;1. Create empty class library2. Add SPCAF.SDK.dll assembly reference3. Create class and add usings4. Add method stub by inheriting from ”Rule”namespace SPSOslo.Rules{public class FeatureNameStartsWithSPSOslo : Rule<FeatureDefinition>{public override void Visit(FeatureDefinition target, NotificationCollection notifications){}}}
  • 18. @mattein #SPCAF5. Add Rule Metadatanamespace SPSOslo.Rules{[RuleMetadata(typeof(Naming),CheckId = "SPC99001",DisplayName = "Feature name should start with SPSOslo",Description = "A feature name should be prefixed with SPSOslo.",DefaultSeverity = Severity.Warning,SharePointVersion = new string[] { "12", "14", "15" },Message = "Feature {0} should start with SPSOslo.",Resolution = "Change the folder name of the feature and add the name at the beginning, e.g.SPSOslo.Intranet.Components_ContentTypesFeature.")]public class FeatureNameStartsWithSPSOslo : Rule<FeatureDefinition>{...
  • 19. @mattein #SPCAF7. Build and drop the assembly into SPCAF installation folderpublic class FeatureNameStartsWithSPSOslo : Rule<FeatureDefinition>{public override void Visit(FeatureDefinition target, NotificationCollection notifications){if (!target.FeatureName.StartsWith("SPSOslo")){string message = string.Format(this.MessageTemplate(), target.FeatureName);Notify(target, message, notifications);}}}6. Implement the rule
  • 20. @mattein #SPCAFSharePoint Code Analysis• is important for EVERYBODY • improves solution quality• improves farm stabilitySPCAF• fills the tooling gap• runs locally and in the cloud• integrates in the ALM process• is extensible
  • 21. @mattein #SPCAFWhere do I get it?Matthias Einig@matteinwww.matthiaseinig.deFollow us!The SharePoint Code Quality TeamTorsten Mandelkow@tmandelkowblogs.msdn.com/b/torstenmandelkowSPCAF@spcafwww.spcaf.com

×