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 (Polyspace Bug Finder) and Coding Standards and Code Metrics (Polyspace Bug Finder). The default analysis checks for a subset of defects. See Polyspace Bug Finder Defects Checkers Enabled by Default (Polyspace Bug Finder). To check for nondefault defects and coding rule violations, configure Polyspace as You Code extension in Visual Studio®.
Create a Checkers File in Visual Studio
Before you can configure checkers in Visual Studio, you first need to create a checkers file and specify the checkers file in the Options dialog box. To create a checkers file, open a command window in Visual Studio and enter this command:
polyspace-checkers-selection
Alternatively, click the icon in the Configuration view. If you have a file path in the Checkers File Polyspace as You Code setting within Visual Studio and the file at the path does not exist, Polyspace as You Code creates the file and opens the Checkers selection window.
Select Checkers and Coding Rules
You can specify an existing checkers file for your Polyspace as You Code configuration. In the toolbar, select Tools > Options and select the Polyspace as You Code node. Specify the full path to the checkers XML file in Checkers File. For equivalent workflows in the Polyspace desktop and server, see Prepare Checkers Configuration for Polyspace Bug Finder Analysis (Polyspace Bug Finder).
Create or Modify Checkers Configuration
Create a new selection of checkers and coding rules or modify an existing selection in the Checker selection window. Save the new configuration in a reusable checkers file.
In the Polyspace as You Code perspective, in the Configuration view, click to open the Checkers selection window. The Checkers selection window is prepopulated by the checkers XML file you specify in Checkers file on the Options dialog box, under Polyspace as You Code > Analysis Options.
Select the defect and coding rule checkers that you want to activate.
You can also activate the predefined categories of defect checkers
All
,Default
,High
,Medium
, andLow
. SelectHigh
,Medium
, orLow
to activate high-impact, medium-impact, and low-impact defects, respectively. See Classification of Defects by Impact (Polyspace Bug Finder). Similarly, you can activate predefined sets 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)
(Polyspace Bug Finder).When selecting Custom rules, review the Pattern and Convention for the rules. See
Check custom rules (-custom-rules)
(Polyspace Bug Finder).To create a custom coding standard classification, or to tag Bug Finder coding rule checkers of interest, enter text in the Comment column of the Checkers selection window. Polyspace displays this 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 extension.
Note
The custom text that you enter in the Checkers selection window is omitted in:
Generated reports.
The Polyspace desktop interface when you open results from Polyspace Access in the desktop interface. This limitation applies only to Bug Finder checkers.
Click Save Changes to commit your selection changes to your checkers file.
Import Checkers Configuration from Desktop Project
You can import checkers and your coding rule configuration from a Polyspace desktop project (.psprj
) file. See Import Analysis Options from Polyspace Desktop Project.
Modify Checker Behavior
To modify the default behavior of Bug Finder defect and coding rule checkers, use analysis options. For a list of analysis options that modify the default behavior of checkers, see Modify Default Behavior of Bug Finder Checkers (Polyspace Bug Finder).
To specify analysis options in Polyspace as You Code:
Append the analysis options in the options file specified in Other Analysis Options File. An options file is a text file with one analysis option for each line. For example, to add the analysis options
-code-behavior-specifications
(Polyspace Bug Finder) andEffective boolean types (-boolean-types)
(Polyspace Bug Finder), append these lines in the options file:-code-behavior-specifications file1 -boolean-types boolean1_t,boolean2_t
If you do not have an options file, create an options file that contains the necessary options. Specify the path to the new options file in Other Analysis Options File. See Options Files for Polyspace Analysis (Polyspace Bug Finder).
Related Topics
- Polyspace Bug Finder Defects Checkers Enabled by Default (Polyspace Bug Finder)
- Options Files for Polyspace Analysis (Polyspace Bug Finder)
- Checkers Deactivated in Polyspace as You Code Analysis
- Modify Default Behavior of Bug Finder Checkers (Polyspace Bug Finder)