-
Notifications
You must be signed in to change notification settings - Fork 364
sonar.cxx.vera.reportPaths
Sensor to read reports from the Vera++ tool. Vera++ is a programmable tool for verification, analysis and transformation of C++ source code. Vera++ is mainly an engine that parses C++ source files and presents the result of this parsing to scripts in the form of various collections - the scripts are actually performing the requested tasks.
Note: The cxx plugin itself does not run the tool, you have to do that yourself beforehand. The sensor only reads the report generated by the tool!
- Link to the tool page: https://bitbucket.org/verateam/vera/wiki/Home
- The sensor supports rules from Vera++ with version 1.3.
In order to run Vera++ and generate a fitting report, make sure:
- to call it from the projects root directory, so that the paths in the report fit
- that the parameter matches the
sonar.sources
list insonar-project.properties
Sample command lines:
Newer versions of Vera++ support the -c / --checkstyle-report
command line option to create a Checkstyle XML report:
vera++ -s -c vera.xml main.cxx
If the tool was executed successfully, a report like the example below should be generated:
<?xml version="1.0" encoding="UTF-8"?>
<checkstyle version="5.0">
<file name="sources/application/main.cpp">
<error line="1" severity="warning" message="no copyright notice found" source="T013"/>
</file>
<file name="sources/utils/utils.cpp">
<error line="1" severity="warning" message="leading empty line(s)" source="L003"/>
<error line="1" severity="warning" message="no copyright notice found" source="T013"/>
</file>
</checkstyle>
- First check if the file extensions read in by the cxx plugin are set (sonar.cxx.file.suffixes).
- The rules for which you want to generate issue must be activated in the Quality Profile of your project. You can find instructions on how to do this under Manage Quality Profiles.
- Set the analysis parameter
sonar.cxx.vera.reportPaths
in the configuration filesonar-project.properties
of your project. The Report Paths link describes the configuration options. - Execute the SonarScanner to transfer the project with the report to the SonarQube Server.
- With CXX Custom Template Rules it's possible to extend the rule repository.
- It is also possible to display unknown rules on the SonarQube Server.
Sample for sonar-project.properties:
sonar.cxx.vera.reportPaths=vera.xml
- If no results are displayed after a successful scan, check Manage Quality Profiles first.
- If you cannot find an issue under 'New code', also look under 'Overall code' to see if it is listed there.
- If scanning is failing, check items listed under Troubleshooting Configuration.
- If no issues are displayed for your source code in SonarQube, check the items listed under Troubleshooting Reports.
- In the case of incomplete scans, Detect and fix parsing errors gives advice on how to fix this.