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.
The only prerequisite is to install and configure Install your favorite analyzer (SonarQube Runner, Maven or 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 as no data is pushed to the database).
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 refers to the directory containing 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 Preview analysis that generates an HTML report:
# Set the "sonar.dryRun" property to "true" to activate the Preview mode sonar-runner -Dsonar.dryRun=true -Dsonar.issuesReport.html.enable=true
Another useful feature is to limit the scope to the files that have been recently created or modified. To do so, the
sonar.inclusions property can be set. In the following example, only the myCobolProgram.cbl Cobol program will be checked:
sonar-runner -Dsonar.dryRun=true -Dsonar.issuesReport.html.enable=true -Dsonar.inclusions=myCobolProgram.cbl
The Issues Report plugin is not yet compatible with multi-module projects. See https://jira.codehaus.org/browse/SONARPLUGINS-2805.