Configure Checkers for Polyspace as You Code in Visual Studio
You can check for various types of defects and coding rule violations by using Polyspace® as You Code in Visual Studio. See Defects and Coding Standards.The default analysis checks for a subset of defects. See Polyspace Bug Finder Defects Checkers Enabled by Default. To check for nondefault defects and coding rule violations, configure Polyspace as You Code extension in your IDE.
To configure checkers, create a checkers file, and then specify the checkers file in the Options window. For equivalent workflows in the Polyspace desktop and server, see Prepare Checkers Configuration for Polyspace Bug Finder Analysis.
Select Checkers and Coding Rules
To select coding rule checkers and nondefault defect checkers, right-click the project on the Solution Explorer pane and select Polyspace properties. Specify the checkers configuration on the Analysis tab.
Create or Modify Checkers Configuration
Create a new selection or modify an existing selection of checkers and coding rules in the Checker selection window. Save the new configuration in a reusable checkers file.
On the Analysis tab in the Polyspace properties window, click
to open the Checkers selection window.
To create a new selection, in the Checkers selection window, select the defect and the coding rule checkers that you want to activate. To modify an existing selection, click Browse, navigate to the existing checkers file and then modify the checkers selection.
You can also activate predefined categories of defect checkers such as All, Default, High, Medium, and Low. See Classification of Defects by Impact. Similarly, you can activate predefined set of coding rules that are defined by their corresponding standards.
When selecting Guidelines > Software Complexity checkers, review their thresholds. If the default thresholds are not acceptable, specify a suitable threshold in the Threshold column. See
Check guidelines (-guidelines)
.When selecting Custom rules, review the Pattern and Convention for the rules. See
Check custom rules (-custom-rules)
.To create a custom coding standard classification, or to tag coding rule checkers of interest, enter text in the Comment column of the Checkers selection window. Polyspace displays that text in the Results Details pane and in the Detail column of the Results List (if available) when you review results in the desktop interface, in Polyspace Access™, or in the Polyspace as You Code plugins.
Save the selection as a reusable checkers XML file by clicking Save Changes. After you click Finish, the path to the new checkers XML file is specified in the field Checkers file on the Analysis tab in the Polyspace properties window.
Import Checkers Configuration from Desktop Project
To import checkers and coding rule selection from a Polyspace desktop project (*.psprj
) file, on the
Analysis tab in the Polyspace
properties window, click Import options from
Polyspace desktop project (*.psprj). Browse to the folder
containing the project file and specify the project file. The checkers
configuration in the desktop project is extracted as a checkers file, which is
specified in the field Checkers file. The analysis options
of the desktop project are extracted as an options file which is specified in
the field Analysis options file.
Modify Checker Behavior
To modify the default behavior of Bug Finder defect checkers and coding rules, use analysis options. For a list of analysis options that modify the default checker behavior, see Modify Default Behavior of Bug Finder Checkers.
To specify analysis options in Polyspace as You Code:
Append the analysis options in the options file specified in the field Analysis options file. An options file is a text file with one analysis option for each line. For instance, to add the analysis options
-code-behavior-specifications
andEffective boolean types (-boolean-types)
, in the options file, append these lines:-code-behavior-specifications file1 -boolean-types boolean1_t,boolean2_t
If you do not have an option file, create an option file that contains the necessary options. Specify the path to the new options file in the field Analysis options file. See Options Files for Polyspace Analysis.