This plugin is deprecated since SonarQube 5.1. See SonarLint for in-IDE support instead.
Description / Features
The Issues Report plugin provides the ability to run local SonarQube analyses on your machine. generate HTML report on issues.
The main use case is for developers to check the code they have added or changed before pushing it back to the SCM.
It generates an HTML report that displays a list of issues that can Here's an example of HTML report (you can download the full report here):
Issues can then be filtered by severity, new issues (comparison made against the latest version available on the remote server)only, etc.
It supports all languages.
Here's an example of HTML report that you can download:
|Note that to perform local analyses, a SonarQube Eclipse plugin is also available. It currently supports Java, C/C++ and Python.|
- Install the plugin through the Update Center or download it into the SONARQUBE_HOME/extensions/plugins directory
- Restart the SonarQube server
|while the Issues Report plugin supports every language, there is also support for certain languages within the IDE. See SonarLint for Eclipse, IntelliJ, and VisualStudio.|
As the main use case is for developers to check the code they have added or changed before pushing it back to the SCM, the Issues Report plugin is usually used in preview mode. This is this usage that is detailed below.
Install your favorite scanner (SonarQube Scanner, SonarQube Scanner for Maven or SonarQube Scanner for Ant) on your local machine. You only have to set the
sonar.host.url property to point to your remote SonarQube server (connection settings to the remote database do not have to be provided for a preview analysis as no data is pushed to the database). Note that you don't need to install any SonarQube server and database on your local machine. Just install and configure your favorite analyzer (SonarQube Runner, Maven or Ant).Then, copy on your local machine the analysis configuration file of the project to analyze
Copy the configuration file (sonar-project.properties, pom.xml, etc.) that is used to analyze the project on the remote server to your local machine. Make sure that the
sonar.sources property property refers to the directory containing your the source code on your local machine (or update it accordingly). The tree structure of the source code on your local machine must match the tree structure that has been remotely analyzed by SonarQube. Finally, run a local analysis:
# Set the "sonar.dryRun" property to "true" to run a local analysis sonar-runner -Dsonar.dryRun=true
To get a local report:
To get an HTML report, set the
sonar.issuesReport.html.enable property to
define its location, set the
to an absolute or relative path to the
destination folder for the HTML report. The default value is .sonar/issues-report
/ for the SonarQube Runner and Ant, and target/sonar/issues-report
/ for Maven. By default 2 html reports are generated:
- The full report (default name is issues-report.html)
- The light report (default name is issues-report-light.html) that will only contains new issues.
The light report is useful when working on legacy projects with a lot of many issues, since the full report may be hard to display in your web browser. You can skip full report generation using property
You can also configure the filename of the generated html reports using property
To display a short report in the console, set the
sonar.issuesReport.console.enable property to true:
Finally, run a preview analysis that generates an HTML report:
# Since SonarQube 4.0 sonar-runner -Dsonar.analysis.mode=preview -Dsonar.issuesReport.html.enable=true # Prior to SonarQube 4.0 sonar-runner -Dsonar.dryRun=true -Dsonar.issuesReport.html.enable=true
Even more useful, you can limit the scope of the analysis to the files that have been recently created or modified. To do so, the
sonar.inclusionsproperty can be set.In the following example, SonarQube will only check the myCobolProgram.cbl Cobol program. The analysis will be local: nothing will be pushed to the database, thus the results will not be available through the SonarQube server web interface. An HTML report will be generated to display the list of issues on the myCobolProgram.cbl file:
(i.e. incremental mode):
# Since SonarQube 4.0 sonar-runner -Dsonar.analysis.mode=incremental -Dsonar.issuesReport.html.enable=true # Prior to SonarQube 4.0, the files have to be manually listed sonar-runner -Dsonar.dryRun=true -Dsonar.issuesReport.html.enable=true -Dsonar.inclusions=myCobolProgram.cbl
|Note that the Issues Report plugin is not yet compatible with multi-module projects. See https://jira.codehaus.org/browse/SONARPLUGINS-2805.|