Local and Remote Mode
When using Sonar in Eclipse, two modes are available:
This is the default mode. Information showed in the remote mode is coming from a remote Sonar server. This means that this information has been computed during the latest analysis on that server.
Thus, you will not see violations introduced in the code that you just added or changed.
When switching to the local mode, information displayed is coming from the latest local analysis.
Thus, you can see the violations introduced in the code that you just added or changed.
Switch from One Mode to Another
To switch from one mode to another, right-click on the project, then select Sonar > Mode > Remote or Local:
When switching to the Local mode, a local analysis will be run automatically.
At any time, to run another local analysis, right-click on the project, then select Sonar > Run Local Analysis:
If some Sonar properties must be specifically passed to the local analysis, this can be achieved at 2 different levels (only with Sonar Eclipse 3.1+):
- At Eclipse level: in the "Sonar > Local analysis properties" panel of Eclipse preferences
- Those properties will be passed to any local analysis run by Eclipse in "Local mode"
- At project level: in the "Sonar > Local analysis properties" panel of the project properties
- Those additional properties will be added to the above ones, but only for analysis on the corresponding project
- They may override properties defined at Eclipse level
Violations View (displays local or remote information depending on the selected mode)
The Violations view displays the list of violations of the selected resource (project, file, etc.):
To refresh violations of resources from remote server, click on the Refresh button.
This view can be displayed by going to Window > Show View > Other... > Sonar > Violations.
Note that Problems and Markers views also displays Sonar violations.
Web View (displays remote information only)
The Web view displays the main project dashboard (for project) or the resource viewer (for class or file).
This web page can also be used to access information and services (Clouds, Hotspots, etc.) that are not available in Sonar Eclipse.
This view is automatically displayed when clicking on Sonar > Open in Sonar server. It can also be displayed by going to Window > Show View > Other... > Sonar > Web.
Last analysis date
It is possible to easily know when the last analysis occurred on a project:
- This date is displayed when going on the "Sonar" panel in the project properties
- This date can be displayed in the navigation views, like the Package explorer or the Navigator. This option is not active by default and should be activated in Eclipse preferences "General > Appearance > Label decorations" (check "Sonar Analysis Date Decorator"). This will look like this: