Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Wiki Markup
{iframe:src=http://update.sonarsource.org/plugins/issuesreport-confluence.html|width=700|height=250400|frameborder=0}
Your browser does not support iframes.
{iframe}

Description / Features

The Issues Report plugin provides the ability to run local Sonar analyses. The generate HTML report on issues.

The main use case is for a developer developers to check his/her code the code they have added or changed before pushing it back to the SCM.

It generates an HTML report that displays a list of violations that can Here's an example of HTML report (you can download the full report here):

Image Added

Issues can then be filtered by severity, new violations issues only, etc.

It supports all languages.

Here's an example of HTML report that you can download:

Image Removed

Info
titleSonar SonarQube Eclipse Plugin
Note that to perform local analyses, a Sonar Eclipse plugin is also available. It currently while the Issues Report plugin supports every language, there is also support for certain languages within the IDE. The SonarQube plugin for Eclipse supports Java, C/C++ and Python. The SonarQube plugin for IntelliJ supports Java.

Simply run a Sonar analysis on your project with your favorite analyzer (Sonar

Include Page
Include - Plugin Installation

  1. Install the Issues Report plugin through the Update Center or download it into the SONAR_HOME/extensions/plugins directory
  2. Restart the Sonar server

Usage

Include - Plugin Installation

Usage

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 analyzer (SonarQube RunnerMaven or Ant) on your local machine.

To run the analysis locally (without making the results available on the Sonar server), set the 'sonar.dryRun' property to 'true'.

To get a local report:

...

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 on your local machine.

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. 

To get an HTML report, set the

...

sonar.issuesReport.html.enable

...

property to

...

true

...

. To define its location, set the

...

sonar.issuesReport.html.location

...

property to an absolute or relative path to the destination for the HTML report. The default value is .sonar/issues-report.html

...

for the

...

SonarQube Runner and Ant,

...

and target/sonar/issues-report.html

...

for Maven

...

.

To display a short report in the console, set the

...

sonar.issuesReport.console.enable

...

property to

...

true

...

:

...

Image Added

Finally, run a preview analysis that generates an HTML report:

 

Code Block
languagebash
# 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.inclusions' property can be set.In the following example, Sonar will only check the 'myProgram.cbl' Cobol program and ignore the other programs of the application. The analysis will be local: nothing will be pushed to the database, thus the results will not be available through the Sonar server web interface. An HTML report will be generated to display the list of violations on the 'myCobolProgram.cbl' file:

(i.e. incremental mode):

 

Code Block
languagenonebash
# 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=src/myCobolProgram.cbl
Note
titleMulti-module project compatibility
Note that the Issues Report plugin is not yet compatible with multi-module projects. See https://jira.codehaus.org/browse/SONARPLUGINS-2805.

 

Change Log

...

,...

 

Include Page
Include - Local Analysis Notes
Include - Local Analysis Notes