Blog

v4.0.7 BETA (2013-09-04)

6 min read
6 min read

SPCAFWe are proud to announce a new release of the SharePoint Code Analysis Framework which includes so many new rules that it is getting hard to count them all 😉

The key changes are:

  • Analysis of JavaScript files with JSHint
  • Analysis of CSS files with CSSLint
  • Replacement of SPDisposeChecker with custom rules, which also allow to analyse .net4 assemblies for SharePoint 2013
  • Support for Visual Studio 2013 Preview
  • Rules can be now configured in the Ruleset Editor to receive parameters

Read more about the changes in the release notes below.

The new BETA release SPCAF 4.0.7 is available for download from the Visual Studio Gallery. If you have a previous release installed you will be notified about the update in the Visual Studio Extension Manager and directly in the SPCAF standalone application.

Download BETARead Docs

Release Notes

New Functionality

  • Custom rules created with older versions of SPCAF can now be loaded by newer SPCAF versions (no recompile needed)
  • Ability to save configuration properties in ruleset files (previous Dictonary.xml not required anymore)
  • Ability to add comments in the ruleset files (which will be added to the reports)
  • New Parameter “Help” in the custom rule metadata can be used to override the URL for help
  • Added analysis of ListDefinitions
  • Integration of CSSLint for analysis of CSS files
  • Integration of JSHint for analysis of JavaScript files
  • Reduced minimum .NET Framework version to 4.0
  • Support for Visual Studio 2013 Preview
  • Renamed default FxCop ruleset from SPCAF.ruleset to MSOCAF.ruleset
  • Aligned MSOCAF.ruleset with current MSOCAF rules
  • Inventory: Added ContentType Group to ContentType inventory
  • Client Application: New function to send error reports to SPCAF support

New Rules

  • Category Correctness
    • SPC015404: DeployMissingListTemplateForListInstance
    • SPC015405: RemoveCurlyBracketsFromFeatureIdInListInstance
    • SPC015406: DeployMissingCustomSchemaForListInstance
    • SPC015705: DeployMissingRibbonImageOfCustomAction
    • SPC015706: DeployMissingRibbonCommandUIHandlerOfCustomAction
    • SPC015212: DefineInheritsToFalseInContentTypeWithForms
    • SPC016503: DefineFieldRefInCorrectCasing
  • Category Design
    • SPC046902: AvoidInlineJavaScriptInASPXPage
    • SPC046903: AvoidInlineCSSInASPXPage
  • Category Best Practice
    • SPC052101: DoNotActivateFeaturesViaAPI
    • SPC050223: DoNotCallSPItemEventPropertiesOpenWeb
  • Category Deployment
    • SPC067601: DoNotDeployWCFWebServiceToLAYOUTS
    • SPC067602: DoNotDeployWCFAdministrationWebServiceToADMIN
  • Category Memory Disposal
    • SPC110201: Dispose created SPSite objects
    • SPC110203: Dispose SPWeb objects created with SPSite.OpenWeb
    • SPC110204: Dispose SPSite objects created with SPSite.SelfServiceCreateSite
    • SPC110205: Dispose SPWeb created by SPLimitedWebPartManager
    • SPC110211: Dispose SPSite created by SPSiteCollection.Add
    • SPC110212: Dispose SPSite created by SPSiteCollection[] index operator
    • SPC110213: Dispose SPWeb created by SPWebCollection.Add
    • SPC110214: Dispose SPWeb created by SPWebCollection[] index operator
    • SPC110231: Do not dispose SPListEventProperties.Web
    • SPC110232: Do not dispose SPWebEventProperties.Web
    • SPC110233: Do not dispose SPItemEventProperties.Web
    • SPC110234: Do not dispose SPItemEventProperties.ListItem.Web
    • SPC110235: Do not dispose SPItemEventProperties.Web.Site
    • SPC110236: Do not dispose SPItemEventProperties.ListItem.Web.Site
    • SPC110237: Do not dispose SPFeatureReceiverProperties.Feature.Parent
    • SPC110241: Do not dispose SPSite.RootWeb
    • SPC110242: Do not dispose SPWeb.ParentWeb
    • SPC110243: Do not dispose SPList.ParentWeb
    • SPC110244: Do not dispose SPSite returned by SPControl.GetContextSite
    • SPC110245: Do not dispose SPWeb returned by SPControl.GetContextWeb
    • SPC110246: Do not dispose SPSite returned by SPContext.Current.Site
    • SPC110247: Do not dispose SPWeb returned by SPContext.Current.Web
    • SPC110261: Close PublishingWeb created by PublishingWeb.GetPublishingWebs[] index operator
    • SPC110262: Close PublishingWeb created by PublishingWeb.GetVariation
    • SPC110263: Close PublishingWeb created by PublishingWebCollection.Add
    • SPC110281: Dispose SPSite created with UserProfiles.PersonalSite

New Depedency Checks

  • SPD015302: ModuleReferencedTemplateFiles
  • SPD027504: ListDefinitionContentTypeReferencesContentType

New ThirdParty Analyzer Rules

  • JSHint
    • JSH318901: Remove debugger statements
    • JSH318902: Do not use bitwise operators
    • JSH318903: Use correct comparison
    • JSH318904: Use camelCase in variables
    • JSH318905: Use curly braces around blocks
    • JSH318906: Use correct === and !==
    • JSH318907: Use correct null comparisons
    • JSH318908: Do not use eval
    • JSH318909: Do not use a single expression
    • JSH318910: Use filter in for in loops
    • JSH318911: Use parens for immediate function invocations
    • JSH318912: Use correct indent
    • JSH318913: Define variable before it is used
    • JSH318914: Use correct line breakings
    • JSH318915: Use correct line breakings around commas
    • JSH318916: Do not make functions within a loop
    • JSH318917: Avoid multi line strings
    • JSH318918: Do not use empty blocks
    • JSH318920: Do not use ‘new’ for side effects
    • JSH318921: Use consistent of quotation marks
    • JSH318922: Do not use single case switch
    • JSH318923: Use regular expressions correctly
    • JSH318924: Avoid . in regexp literals
    • JSH318925: Declare variable before it is used
    • JSH318926: Avoid JavaScript URLs
    • JSH318927: Remove unused variables
    • JSH318928: Avoid redeclaring a variable
    • JSH318929: Avoid correct construction of objects and function
    • JSH318930: Avoid this in non-constructor functions
    • JSH318931: Do not use arguments.caller and arguments.callee
    • JSH318941: Use semicolon correctly
    • JSH318942: Define uppercase constructors
    • JSH318943: Do not use unary increment and decrement operators
    • JSH318944: Use semicolon in last statement
    • JSH318945: Use dot notation instead of []
    • JSH318946: Avoid trailing whitespaces
    • JSH318961: Do not exceed max number of formal parameters per function
    • JSH318962: Do not exceed max number of nested blocks in a function
    • JSH318963: Do not exceed max number of statements per function
    • JSH318964: Do not exceed max allowed cyclomatic complexity
    • JSH318965: Do not exceed max length of a line in code
  • CSSHint
    • CSL308801: Avoid unwanted box model sizing issues in CSS
    • CSL308802: Avoid properties that don’t work based with the display property being used in CSS
    • CSL308803: Avoid duplicate properties in CSS
    • CSL308804: Avoid un anchored hovers in CSS
    • CSL308805: Avoid empty rules in CSS
    • CSL308806: Use only known properties in CSS
    • CSL308807: Avoid adjoining classes in CSS
    • CSL308808: Avoid property box-sizing in CSS
    • CSL308809: Use compatible vendor prefixes in CSS
    • CSL308810: Use all gradient definitions in CSS
    • CSL308811: Avoid negative text indent in CSS
    • CSL308812: Use standard property with vendor prefix in CSS
    • CSL308813: Use fallback colors in CSS
    • CSL308814: Avoid star hack in CSS
    • CSL308815: Avoid underscore hack in CSS
    • CSL308816: Use bulletproof font face in CSS
    • CSL308817: Do not use too many web fonts in CSS
    • CSL308818: Do not use @import in CSS
    • CSL308819: Avoid selectors that look like regular expressions in CSS
    • CSL308820: Do not use universal selector in CSS
    • CSL308821: Do not use unqualified attribute selectors in CSS
    • CSL308822: Do not use units for zero values in CSS
    • CSL308823: Avoid overqualified elements in CSS
    • CSL308824: Use shorthand properties in CSS
    • CSL308825: Do not use duplicate background images in CSS
    • CSL308826: Avoid too many floats in CSS
    • CSL308827: Do not use too many font size declarations in CSS
    • CSL308828: Do not use IDs in selectors in CSS
    • CSL308829: Do not use !important in CSS
    • CSL308830: Do not use outline:none in CSS
    • CSL308831: Do not use qualified headings in CSS
    • CSL308832: Define headings only once in CSS

Fixes

  • Custom Rules without Metadata will not crash SPCAF
  • Fix in rule SPC030203 Do not read ConnectionString from SPContentDatabase
  • Fixed endless loop during loading of imported WebTemplate project
  • Fixed: SPCAF menu not enabled in Visual Studio when a project is unloaded

Changes

  • SPC016501: DeclareRequiredAttributesInFieldRef Remove DisplayName
  • SPC015105: DeclareAllRequiredAttributesInFields Removed check for attribute ‘Required’
  • Help: Changed root URL for documentation to http://docs.spcaf.com/v4
  • Changed rule categories: Not loaded from SDK anymore

Subscribe to our newsletter