In this section
Introduction
The Parasoft SonarQube Importer extension imports static analysis results from a SonarQube server to Parasoft DTP so that the results can be processed and viewed along with other data points in Parasoft DTP dashboards and reports.
The integration also adds scope, authorship, and source control support that further enhance SonarQube's capabilities. Additionally, the extension generates a Parasoft report that shows violations for each author and severity.
Requirements
- SonarQube version 9.1 is currently supported.
- SonarQube should be installed and successfully running analysis.
Configuration
In addition to the required Parasoft DTP settings (refer to Connecting to DTP), the following settings are also required to run the SonarQube Importer extension. Open the settings.properties file located in Multi-Language Pack installation directory and specify the following properties settings.
sonarqube.endpont
SonarQube server URL, including port number and protocol name (http:// or https://).
Example:
sonarqube.endpoint=https://localhost:9000
sonarqube.project.key
Name of the project in SonarQube.
Example:
sonarqube.project.key=Parabank
sonarqube.user.id
SonarQube user ID for logging in.
sonarqube.password
SonarQube user password. You can enter the password as plain text or as an encoded string. See dtp.password for instructions on how to encode your password.
Example Configuration
sonarqube.endpoint=http://myserver.company.com:9000 sonarqube.project.key=demo sonarqube.user.id=admin sonarqube.password=admin
Usage
- If you have not already done so, set up a SonarQube project and verify that the static analysis results are published to the SonarQube server.
- Verify that the Parasoft Multi-Language Pack settings.properties file is properly configured.
- Open a command prompt and navigate the Multi-Language Pack installation directory.
- Execute the multilanguage-pack.bat or multilanguage-pack.sh script using the required parameters all on one line, e.g.:
multilanguage-pack.bat -tool sonarqube -source.dir "C:\sample\sampleProjectFolder"
Results
The extension performs the following actions during execution:
- connects to the SonarQube server
- reads static analysis results from the specific project
- associates the results with the source code on disk in the folder specified by source.dir parameter
- produces and HTML report in MLP_INSTALL_DIR/reports directory
- sends the results to Parasoft DTP (see Viewing Results)
Required Parameters
The following settings are required when executing the multilanguage-pack.bat or multilanguage-pack.sh script.
tool
Specifies the Parasoft extension to execute. Use -tool sonarqube
to run the SonarQube extension.
source.dir
Specifies the path to the folder containing the source code analyzed by SonarQube. This is used to collect source control metadata (e.g., authorship, last updated, etc.) for DTP reporting and processing.