Configure Checkers for Polyspace as You Code in Eclipse
You can check for defects and coding rule violations by using Polyspace® as You Code in Eclipse™. The default analysis checks for a the default Polyspace Bug Finder™ defects. To check for other defects and coding rule violations, configure Polyspace as You Code extension.
To configure checkers, you can reuse an existing configuration. Alternatively, you can configure checkers 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 methods to configure checkers in the Polyspace as You Code Extension for Eclipse.
Use Existing Checkers Activation File
You can use a checkers activation file (XML
) or a
user-defined coding standard (.pschk
) to configure checkers. A checkers
activation file activates a set of Bug Finder defects and external coding rules. A user-defined
coding standards allow you to collect coding rules that are relevant specifically to your
project into a single standard when an existing coding standard does not exactly meet your
needs. If you have one of these artifacts, specify the path to it in the Preferences window:
Click in the Configuration pane to open the Preferences window.
In the setting Checkers File of the Analysis node, enter the full path to the checkers activation file or the user-defined coding standard file.
Optionally, you can modify the selection of checkers. In the Configuration section, click the Configure Checkers icon to open the Checkers Selection window. Modify the selection of checkers 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:
ps-migrate-checkers-selection -import-options-from-psprj PathToProject
The command
ps-migrate-checkers-selection
is located in the folder
.polyspaceroot
\polyspace\bin\arch
is the location of the Polyspace installation folder in your development environment andpolyspaceroot
is one ofarch
win64
,glnxa64
, ormaci64
.PathToProject
is the full path to the Polyspace desktop project.
After you run the command, Polyspace creates a checkers activation file using the imported checkers configuration. The
checkers activation file is stored in a subfolder named import
in the same
location as the .psprj
file. Use the activation file in the
Checkers File setting.
Alternatively, you can import the .psprj
project file as a
.psprjx
project file by opening the .psprj
file in the
Polyspace Platform user interface. Polyspace creates a checkers activation file using the checkers configuration of the
.psprj
file. To get the path to your checkers activation file, go to
Configuration and select the Static Analysis tab. The
path is under Defects and Coding Standards > Checkers activation file. Specify the path to the checkers activation file n the Checkers
File setting.
For more details, see Generate Build Options for Polyspace as You Code Analysis in Eclipse.
Create Checkers Configuration
If you do not have a checkers activation file (XML
), you can create it by
using the Checkers Selection window. Creating user-defined coding standards
(.pschk)
from the Checkers Selection window is not supported. For details
about how you can create your own user-defined coding standard, see Create User-Defined Coding Standard by Using Polyspace Bug Finder Checkers (Polyspace Bug Finder).
To open the Checkers Selection window, select the Configure Checkers icon in the Configuration pane.
In the Checkers Selections 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 sets of coding rules that are defined by their 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.
Save the selection as a reusable checkers activation file by clicking Save changes. Click Finish to close the window.
You can later reuse the checkers activation file as an input in Checkers 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 (Polyspace Bug Finder).
To specify analysis options 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 node of the Preferences 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) andEffective boolean types (-boolean-types)
(Polyspace Bug Finder), in the options file, append these lines:where-code-behavior-specifications file1 -boolean-types boolean1_t,boolean2_t
file1
is a code behavior specification file (XML
) andboolean1_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).
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)