How to : Run SPCAF in a YAML Build?

This article will explain how to run SPCAF in a YAML build and detailed all parameters to be used.

SharePoint code analysis can also be executed through a YAML build. In order to run SPCAF, you must first upload it to your build environment. First, you will need to download SPCAF from our downloads page.

You will then need to upload the task to your build environment. Details are on doing this can be found below:

Once uploaded to your build you will then need to edit your build and paste the following code into your environment.

 - task:SPCAFAnalysisTask@7

   displayName:'SPCAF code analysis for SharePoint and Office projects'

   inputs:

   spcafinputdirectory:<EnterInputDir>

   spcafoutputdirectory:<EnterOutPutDir>

   spcaflicense:<EnterLicenseFile>

   spcafsetting:<EnterSettings>

   spcafreportCSV:true

   spcafreportXML:true

   spcafreportDGML:true

   spcaflogfile:<EnterLogFileHere>

   spcafoutputfile:<EnterOutputFileHere>

   spcafverbosity:detailed

   spcaftempfolder:<EnterTempFolderHere>

   spcaftreatErrorsAsWarnings:true

   spcafcustomrules:<EnterCustomRulesFolder>

Once the code has been pasted into the build, you will need to edit the parameters below before running the build:

spcafinputdirectory Enter the location to be used for the analysis.
spcafoutputdirectory Enter the location where you want your report to be located.
spcaflicense Enter the location to the SPCAF license.
spcafsettings Enter the location to your custom ruleset or specify the name of a Rencore Standard ruleset.
spcaflogfile Enter the name of the log file,
spcafoutputfile Enter the name of the results file.
spcafverbosity

Specifies the amount of information displayed in the output window:

  • Quiet: No Output.
  • Minimal: Only notification is listed (typically used in automated builds).
  • Normal: notifications and status information is listed.
  • Debug: notification, status information, and errors are listed.
  • Default: normal.
spcaftempfolder The directory in which all temporary files are extracted.
spcafcustomrules Enter the location of your custom rules.

 

The following parameters can be omitted depending on how you want SPCAF to run in the build:

spcafreportCSV This parameter can be omitted if you do not want the report to be generated as .csv
spcafreportXML This parameter can be omitted if you do not want the report to be generated as .xml
spcafreportDGML This parameter can be omitted if you do not want the report to be generated as .dgml
spcafcustomrules This parameter can be omitted if you do not want to use custom rules.
spcaftreatErrorsAsWarnings This parameter can be omitted if you do not want the build to stop if an error is found.

Once all parameters have been edited or removed, save and run the build.

Tags

Pre-Production | YAML | Build | Run | SPCAF | Analysis | Analyse | Analyze