Guide

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:*SPCAFAnalysisTask@7

*displayName:*‘SPCAF code analysis for SharePoint and Office projects’

inputs:

<em>   spcafinputdirectory:</em><strong><EnterInputDir></strong><br></br><br></br><em>   spcafoutputdirectory:</em><strong><EnterOutPutDir></strong><br></br><br></br><em>   spcaflicense:</em><strong><EnterLicenseFile></strong><br></br><br></br><em>   spcafsetting:</em><strong><EnterSettings></strong><br></br><br></br><em>   spcafreportCSV:</em><strong>true</strong><br></br><br></br><em>   spcafreportXML:</em><strong>true</strong><br></br><br></br><em>   spcafreportDGML:</em><strong>true</strong><br></br><br></br><em>   spcaflogfile:</em><strong><EnterLogFileHere></strong><br></br><br></br><em>   spcafoutputfile:</em><strong><EnterOutputFileHere></strong><br></br><br></br><em>   spcafverbosity:</em><strong>detailed</strong><br></br><br></br><em>   spcaftempfolder:</em><strong><EnterTempFolderHere></strong><br></br><br></br><em>   spcaftreatErrorsAsWarnings:</em><strong>true</strong><br></br><br></br><em>   spcafcustomrules:</em><strong><EnterCustomRulesFolder></strong>

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

spcafinputdirectoryEnter the location to be used for the analysis.
spcafoutputdirectoryEnter the location where you want your report to be located.
spcaflicenseEnter the location to the SPCAF license.
spcafsettingsEnter the location to your custom ruleset or specify the name of a Rencore Standard ruleset.
spcaflogfileEnter the name of the log file.
spcafoutputfileEnter the name of the results file.
spcafverbositySpecifies 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.
spcaftempfolderThe directory in which all temporary files are extracted.
spcafcustomrulesEnter the location of your custom rules.

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

spcafreportCSVThis parameter can be omitted if you do not want the report to be generated as .csv
spcafreportXMLThis parameter can be omitted if you do not want the report to be generated as .xml
spcafreportDGMLThis parameter can be omitted if you do not want the report to be generated as .dgml
spcafcustomrulesThis parameter can be omitted if you do not want to use custom rules.
spcaftreatErrorsAsWarningsThis 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.

Last updated: 7/31/2024