Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Note

This page documents version 3.3 of the SonarQube Eclipse plugin. For prior versions, click here.

While browsing the source code, SonarQube in Eclipse highlights issues. But its added value is to be able highlight the new issues that you have introduced while adding/modifying the source code. You can thus check your code prior to pushing it to the SCM to make sure that you haven't introduced any new issues.

Running an Analysis

To run a new analysis, right click on your project and go to SonarQube > Analyze. You can also hit Ctrl+Alt+Q wherever you are in your project to trigger a new analysis.

Image Added

By default, the analysis mode is incremental. Because only new/modified files are checked, you get feedback and the list of new issues very quickly.

Note that you can also run an analysis on a working set. This allows you to trigger several analyses at once on all the projects of the working set.

Analysis Parameters

Parameters are retrieved as defined below:

  • Parameters defined in the SonarQube Web UI
  • Parameters set in the pom.xml file (for Maven projects only, with the m2e connector installed) will override parameters defined in the UI
  • Parameters defined in Eclipse will override  parameters defined in the pom file (go to Window > Preferences > SonarQube > Preview analysis properties)
  • Parameters defined at project level in Eclipse will override parameters defined at Eclipse level (right click on the project and go to Properties > SonarQube > Preview analysis properties)
Info
titleExcluding Plugins

Some plugins (useless for a preview analysis) can be skipped thanks to the sonar.preview.excludePlugins (was sonar.dryRun.excludePlugins prior to SonarQube 4.0) property. This property can be set through the SonarQube web interface: Settings > General Settings > General > General).

The default value is "devcockpit,pdfreport,report,scmactivity,views,jira". For example, to skip the Build Stability plugin (due to https://jira.codehaus.org/browse/SONARIDE-346), set the property to edevcockpit,pdfreport,report,scmactivity,views,jira,buildstability".

Last Analysis Date

There are two ways to know when the last analysis was run on a project:

  • Right-click on the project in the Project Explorer, and then Properties > SonarQube
  • This date can be displayed on the navigation views, like the Project explorer or the Navigator. This option is not active by default. To activate it, go to Window > Preferences > General > Appearance > Label Decorations and check SonarQube Analysis Date Decorator:

Image Added

Browsing the Results

Four different views are available to browse the quality of your projects:

...

This view allows you to access the SonarQube web interface. This view is automatically displayed when clicking on SonarQube > Open in SonarQube server. It can also be displayed by going to Window > Show View > Other... > Sonar > Sonar Web Browser.

 

 

Local Analysis Parameters

Parameters to configure local analysis can be set in various places. Here is the hierarchy of parameters:

  • Parameters defined in the SonarQube Web UI
  • Parameters set in the pom.xml file (for Maven projects only, with the m2e connector installed) will override parameters defined in the UI
  • Parameters defined in Eclipse will override  parameters defined in the pom file (go to Window > Preferences > Sonar > Local analysis properties)
  • Parameters defined at project level in Eclipse will override parameters defined at Eclipse level (right click on the project and go to Properties > Sonar > Local analysis properties)
Info
titleExcluding Plugins

Some plugins (useless for a local analysis) can be skipped while performing a local analysis thanks to the sonar.dryRun.excludePlugins property (Settings > Configuration > General Settings > General > General).

The default value is 'devcockpit,pdfreport,report,scmactivity,views'. For example, to skip the Build Stability plugin (due to https://jira.codehaus.org/browse/SONARIDE-346), set the property to 'devcockpit,pdfreport,report,scmactivity,views,buildstability'.

Last Analysis Date

There are two ways to know when the last analysis was run on a project:

  • Right-click on the project in the Project Explorer, and then Properties > Sonar
  • This date can be displayed on the navigation views, like the Project explorer or the Navigator. This option is not active by default. To activate it, go to Window > Preferences > General > Appearance > Label Decorations and check Sonar Analysis Date Decorator:

Image Removed

FAQ

No issues are displayed

...