How to : Run SPCAF in a YAML Build?

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: SPCAFAnalysisTaskDogFood@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 in to the build, you will need to edit the parameters below before running the build:

spcafinputdirectory Enter the location to be used for analysis
spcafoutputdirectory Enter the location to where you want your reports and results to go.
spcaflicense Enter the location to the SPCAF License 
spcafsettings Enter the location to your custom ruleset or specify the name of a standard ruleset.
spcaflogfile Enter the name of the log file.
spcafoutputfile Enter the name for the results file 
spcafverbosity Specifies the amount of information to display in the output window: 
  • Quiet: No output.
  • Minimal: only notifications are listed (typically used in automated builds).
  • Normal: notifications and status information are listed.
  • Debug: notification, status information, and errors are listed.
  • Default: normal.
spcaftempfolder Directory into which all temporary files are extracted. 
spcafcustomrules Enter the location to 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.

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.