This article explains how to select a specific Ruleset for analysis.
SPCAF comes with 6 pre-configured rulesets that you can use to analyze your project. These rulesets are "All Analyzers", "Minimum Settings", "Minimum Recommended Settings", "Extended Recommended Settings (default)", "SharePoint Framework - All Rules", and "Angular Application". For more details on these rules please click here.
Depending on the interface you use to analyze your project, please follow the instructions below:
In order to select the ruleset for analysis in the Client Application you will need to:
1. Open the client and choose either a file or folder to analyze.
2. On the "Configure Analysis" screen click below settings.
3. Depending on whether you wish to use a default ruleset or a custom ruleset you will need to follow the details below.
- Default ruleset
A drop-down menu will appear. From here, select the ruleset you wish to use for analysis.
- Custom Ruleset
Alternatively, if you wish to use a custom ruleset, on the same screen click the "Folder" icon to open a custom ruleset. For more information on how to create your own custom ruleset, please see the knowledge base article How to: Create a Custom Ruleset.
4. Then click "Save" and run the analysis as normal.
In order to select the ruleset for analysis in Visual Studio you will need to:
- Click on "Tools"
- Go to "SharePoint Code Analysis"
- Then click on "Ruleset:<name of a ruleset>".
- A pop up will appear with a drop-down menu. From here select the ruleset, you wish to use for analysis.
- If you wish to use a custom ruleset, select <browse> a file dialog will appear, select the ruleset you wish to use. For more information on how to create your own custom ruleset, please see the knowledge base article How to: Create a Custom Ruleset.
5. Then click "OK" and run the analysis as normal.
In order to select the ruleset for analysis in the PowerShell, you will need to make sure that the parameter "SettingsFile" is set, to the filename and location of the ruleset you wish to use.
In order to select the ruleset for analysis in the CmdLine, you will need to set the filename and path for the argument -s. For example, the command line would be:
spcaf.exe -s "C:\Program Files (x86)\Rencore\SPCAF\Rulesets\RS00_AllRules.spruleset).
The recommended practice is to configure and store a settings file (Ruleset) per project. This allows you to change the build requirements for that project without affecting other projects.
In order to set the ruleset for analysis in TFS/Azure DevOps, you can either type the file location in the field for "Settings File" , enter the name of a standard ruleset (i.e. RS00_AllRules.spruleset) or click the ellipses next to the field and select the file directly.