Main Content

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®. The default analysis checks for a subset of defects. To check for nondefault defects and coding rule violations, configure Polyspace as You Code extension in your IDE.

To configure checkers, you can reuse an existing checker file. Alternatively, you can create a checkers file directly from your IDE. For equivalent workflows in the Polyspace desktop and server, see Prepare Checkers Configuration for Polyspace Bug Finder Analysis (Polyspace Bug Finder).

Depending on what resource or artifact is available to you, use one of the following workflows to configure checkers in your IDE extension.

Use Existing Checkers Activation File

You can use a checkers activation file (.XML) to configure checkers. A checkers activation file enables a set of Bug Finder defects and external coding rules. If you have an activation file, specify the path to it in the Options window:

  1. Click Settings in the Configuration view to open the Options window.

  2. In the setting Checkers File of the Analysis Setup view, enter the full path to the checkers activation file.

Optionally, you can modify the selection of checkers. In the Configuration view, click the Configure Checkers icon (checkers settings) to open the Checkers Selection window. Modify the checker selection and then save your changes. Click Finish to close the window.

Import Checkers Configuration from Project

If you have a Polyspace desktop project file (.psprj), you can import the checkers configuration from it. At the command line, enter:

polyspace-checkers-selection -import-options-from-psprj PathToProject

  • The command polyspace-checkers-selection is located in the folder polyspace/bin where polyspaceroot is the location of the Polyspace installation folder in your development environment.

  • PathToProject is the full path to the Polyspace desktop project.

After you run the command, Polyspace creates a checkers activation file using the checkers configuration in the project. The checkers activation file is stored in the subfolder import folder in the same location as the .psprj file. . Specify this file in the setting Checkers File in the Options window.

For more details, see Generate Build Options for Polyspace as You Code Analysis in Visual Studio.

Create Checkers Configuration

If you do not have a checkers activation file (.XML), you can create it from Visual Studio by using the Checkers Selection window.

  1. To open the Checkers Selection window, select Configure Checkers icon (checkers settings) in the Configuration view.

    Polyspace Checkers selection interface

  2. In the Checkers Selection window, select the checkers that you want to activate. You can also activate predefined categories of defect checkers such as All, Default, High, Medium, and Low. See Classification of Defects by Impact (Polyspace Bug Finder). 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) (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 classify Bug Finder defects or coding rule checkers using your own classification tag , 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.

      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. This limitation applies only to Bug Finder checkers.

  3. Save the selection as a reusable checkers XML file by clicking Save Changes. Click Finish to close the window.

You can later reuse the checkers XML file as an input in the field Checkers file.

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 for checkers in Polyspace as You Code:

  • Append the analysis options in the options file specified in the field Other Analysis Options File. This setting is located in the Analysis Setup section of the Options window. Specify the path to a text file that contains one analysis option per line. For example, to add the analysis options -code-behavior-specifications (Polyspace Bug Finder) and Effective boolean types (-boolean-types) (Polyspace Bug Finder), in the options file, append these lines:

    -code-behavior-specifications file1
    -boolean-types boolean1_t,boolean2_t
    where file1 is a code behavior specification file (XML) and boolean1_t,boolean2_t are boolean types.

  • If you do not have an option file, create an options file that contains the necessary options. Specify the path to the new options file in the field Other Analysis Options File. See Options Files for Polyspace Analysis (Polyspace Bug Finder).

See Also

(Polyspace Bug Finder)

Related Topics