Configure Polyspace as You Code in Eclipse
Configure the Polyspace® as You Code plugin before you begin your first analysis. Configuration of the plugin allows you to customize your workstation and analysis preferences. The plugin preserves settings between sessions.
In this tutorial, you:
Manually configure the build.
Automatically add files to the Quality Monitoring list.
Set up automatic analysis of files on save.
Configure Polyspace checkers.
View header file findings.
Configure an analysis script.
Open your files in Eclipse™. Open the Polyspace as You Code perspective by going to Window > Perspective > Open Perspective > Polyspace as You Code. The perspective contains different panes such as Quality Monitoring, Configuration, and Baseline.
Manually Configure Your Build
You have the option of manually configuring your build. Manual setup of the analysis involves specifying build options. You can extract build options from a build command, an Eclipse C/C++ project, or a JSON Compilation Database file or specify them in a Polyspace build options file.
Click the preferences icon in the Configuration pane or go to Window > Preferences > Polyspace as You Code > Analysis.
Choose how to provide your options file using the Build setting under Analysis Setup: Manual setup. To provide the path to your options file, use the relevant option of the same file type. For example, if your options file is a JSON Compilation Database file, select Get from JSON Compilation Database file and enter the path to the file.
For this tutorial, leave Build set as Build options file not required.
For more information on build options, see Configure Analysis Settings.
Automatically Add Files to Quality Monitoring List
Polyspace has a Quality Monitoring list that keeps track of edited files. Polyspace can analyze all files in the Quality Monitoring list at the same time. You can choose to have Polyspace automatically add files to the Quality Monitoring list or manually add files.
To automatically add files to the Quality Monitoring list when you save a file, select Add to Quality Monitoring list on save.
To manually add files to the Quality Monitoring list, right-click inside the file editor and select Add file to the Polyspace Quality Monitoring list.
For this example, automatically add files to the quality monitoring list. Click the preferences icon in the Configuration pane and select the check box for Add to Quality Monitoring list on save.
Analyze Files Automatically
Polyspace can automatically run an analysis of any file in the Quality Monitoring list when you save the file. Alternatively, you can manually run analysis of individual files or a group of files.
You can manually trigger an analysis in these ways:
Select a file in the Quality Monitoring list and then click the Run Polyspace Analysis button .
Right-click inside the file editor and select Run Polyspace Analysis.
Turn on automatic analysis of files. Click the preferences icon in the Configuration pane and select the check box for Start analysis on save.
Configure Polyspace Checkers
Polyspace checks for a default set of checkers. You can customize this set of standards and defects to check for specific certification standards. Use the preferences option Checkers File to set the checkers XML file for your project.
Turn on the AUTOSAR C++14 checkers for your project. In the Configuration pane, click the Configure Checkers icon to open the Checkers selection window.
You can create, save, and open saved checkers selection files. For more information, see Configure Checkers for Polyspace as You Code in Eclipse.
Click AUTOSAR C++14 on the left pane of the Checkers Selection window. In the right pane, select the All check box to enable all of the AUTOSAR C++14 rules. Click Save Changes in the top right corner to save your checker selection and close the window to return to the Eclipse application.
View Header File Findings
You can run an analysis on header files as if they were source files by adding them to the Quality Monitoring list and running an analysis.
Manually add the
example.hpp header file to the
Quality Monitoring list and initiate an analysis by
clicking the Run Polyspace Analysis button .
Configure Analysis Script
You can provide a script to configure and run your Polyspace analysis in Polyspace as You Code.
For this tutorial, you do not set a script.
If you have a script, click the preferences icon in the Configuration pane
and select Analysis. For the option Analysis
Script. Provide the path to your
script under the option Script file by clicking
Browse and opening your script.
Once you configure the Polyspace as You Code plugin, you are ready to run an analysis and review your results.