Configure Polyspace as You Code Plugin in Eclipse
Polyspace® as You Code allows you to find bugs and coding rule violations while you work in your Eclipse™-based IDE.
After you install the Polyspace as You Code analysis engine and Eclipse plugin, configure the plugin so that a Polyspace analysis runs smoothly when you save your code or explicitly start an analysis. An analysis has run smoothly if results appear as you expect, either as source code markers with tooltips or in a list in the Polyspace Problems view.
To configure the Eclipse plugin, go to Window > Preferences and select the Polyspace as You Code node in the Preferences window. You can also open the Preferences window by pressing Alt+W+P. Under the Polyspace as You Code node, select:
Analysis to configure the analysis options for the projects
Baseline to configure the use of analysis results you download from Polyspace Access™ as a baseline
To save your configuration, click Apply and Close, or click Apply to save your changes and continue making edits to the configuration. To restore default configuration values, click Restore Defaults. All settings retain their current values when you reinstall the plugin.
Specify Polyspace as You Code Preferences
Setting | Description |
---|---|
Polyspace installation folder | Root folder of the Polyspace as You Code installation, for instance, Polyspace attempts to fill this setting in automatically. |
Working directory | Folder where analysis results are stored. Each new run overwrites results of the previous run. The default working directory is stored under your system temporary folder, and typically contains
|
Justification catalog | Specify the full file path of the justification catalog JSON file. Use this setting if your team or organization has a predefined set of comments that they use to justify results. You can store these justifications in a catalog file and associate one or more justifications with a specific result or result family. If you use the Polyspace syntax to annotate a result, the annotation comment is autofilled with the justifications that you store in the catalog for that result. For details of the Polyspace syntax, see Annotation Syntax Details (Polyspace Bug Finder). To create a justification catalog, see Use a Justification Catalog to Autocomplete Annotations in Polyspace as You Code plugins. |
Debug Mode | Enable or disable debugging.
|
Help Improve Polyspace as You Code | Enable or disable the sharing of user experience information with MathWorks®.
|
Port | Specify the port number that the Polyspace as You Code plugin uses on startup to establish an internal connection with the analysis engine. Use this setting if, for example, your machine is configured with a firewall and you want to specify an open port in the firewall. By default, port 0 is specified and Polyspace queries your system for an available port and uses whichever port your system returns. If you run multiple instances of Eclipse that access different workspaces, specify a different port for each instance. If you change this setting, you might need to restart your Eclipse IDE. If you let Polyspace obtain a port number automatically (port 0), the plugin might connect to a different port when you restart your Eclipse IDE and you might need to regenerate your build options. |
Configure Analysis Settings
Specify which actions the plugin performs on save and configure how the plugin obtains information about your build system.
Polyspace analyzes only files that are part of the Eclipse workspace. To add a file to a workspace, you add it to a project in that workspace. Polyspace does not analyze files that are not in the workspace even if you add them to the Quality Monitoring list. If a file that you analyze includes a file that is not in the workspace, the Polyspace as You Code analysis runs, but does not report any findings for the included file.
Setting | Description |
---|---|
Add to Quality Monitoring list on save | Select how you add files to the Quality Monitoring list. Polyspace as You Code analyzes only files in this list.
|
Start analysis on save | Select when Polyspace as You Code runs on files that are in the Quality Monitoring list.
|
Perform analysis in fast-mode | Toggle on or off fast analysis mode. This option is disabled by default. Fast analysis decreases the duration of your Polyspace as You Code analysis by checking only for specific types of issues. This option enables only checkers for issues that are syntactic and do not require abstraction or data flow calculations. Polyspace excludes checkers that are not syntactic or require abstraction of the code from a fast analysis. These exclusions are in addition to the Checkers Deactivated in Polyspace as You Code Analysis. Use fast analysis to iteratively identify and address bugs that are smaller in scope and addressable earlier in the development process. To take full advantage of the defects that Polyspace as You Code can find, use fast analysis as a precursor to a full Polyspace as You Code analysis of your code. The The Configuration view shows |
Analysis Setup | Select between manual setup and a script.
|
Set Up Analysis by Using Script
Run a script each time you save your code or you explicitly run an analysis.
Setting | Description |
---|---|
Script file | Use this setting if you choose Use a script if you switch between files from components that have different build configurations or you use a custom tool to set up your build environment. Enter the full path to a script that runs each time you start a Polyspace as You Code analysis. You can write the script in any language. On Windows, the extension supports scripting languages only for scripts that are executable from the Command Prompt window. The plugin passes these setting values as parameters to the script:
Optionally, the plugin passes these additional settings to the script if you specify them:
For example, this Windows batch script assigns the paths of the source file
(
If you enable this setting, the plugin ignores the Analysis Setup: Manual setup and Baseline settings. Note The Polyspace as You Code plugin does not check the exit
status of the commands in your script. Make sure your script
checks exit codes (for instance, by using
Typically, the Polyspace binaries return 0 on success and a non zero value on failure. |
Script File Arguments | Use this setting to specify additional parameters that the plugin passes to the script when you run an analysis. For example, you might want to run a command on preprocessed files to work around a compilation error. See |
Set Up Analysis Manually
Setting | Description |
---|---|
Build | Specifics of your build configuration. Provide Polyspace as You Code with build configuration information such as data type sizes and compiler macro definitions so that the analysis runs without errors. For more information on how to generate these options, see Generate Build Options for Polyspace as You Code Analysis in Eclipse.
|
Build Command | Specify the build command name exactly as you would enter on a command-line terminal or console. Use a build command that performs a complete build of all files in your workspace and not an incremental build. Fill in this setting if you select |
JSON Compilation Database file | Specify the full path to a database file (typically named Use a build command that performs a complete build of all files in your workspace and not an incremental build. Fill in this setting if you select |
Polyspace Build Options File | Specify the full path to a Polyspace build options file. The options file is a text file with one Polyspace analysis option per line. Fill in this setting if you select |
Checkers file | Path to a checkers configuration file. To create this file, click If you set the Analysis Setup setting to See also Configure Checkers for Polyspace as You Code in Eclipse. |
Other Analysis Options | Path to an options file. The options file contains one Polyspace analysis option per line. For example: -D _WIN32 -termination-functions exit_handler You typically do not need to specify additional options in an options file. However, in some situations, you might want to use an options file. For instance, if you want to manually specify Polyspace options related to your build command, select If you set the Analysis Setup setting to See also Options Files for Polyspace Analysis (Polyspace Bug Finder). |
Configure Baseline Settings
Set these options to compare your local results against a baseline from Polyspace Access consisting of results from a previous analysis of the code. After you download a baseline from Polyspace Access, you can distinguish between new results and baseline results in subsequent runs of Polyspace as You Code.
You can also create a local baseline for your source files. See Set Baseline Polyspace as You Code Results in Eclipse.
Setting | Description |
---|---|
Show Baseline information | When you run an analysis, Polyspace imports review information from the baseline run. Specify which results appear in the Polyspace Problems pane by specifying one of these values:
See also Set Baseline Polyspace as You Code Results in Eclipse. |
Polyspace Access URL | URL of the Polyspace Access instance from which you get a baseline. After you obtain a baseline from Polyspace Access, subsequent runs of Polyspace as You Code allow you to distinguish between new results and baseline results that are present in existing code. See also Set Baseline Polyspace as You Code Results in Eclipse. |
Polyspace Access Login | Specify the username that you use to log into Polyspace Access. Later, when you click the Download Baseline icon in the Baseline view of the Polyspace as You Code perspective, you are prompted for the password that corresponds to this username. |
Project path | Path of the project in the Polyspace Access Project Explorer that you use as a baseline. |