Local and Remote Mode
When using Sonar in Eclipse, 2 modes are available:
This is the default mode. Information showed in the remote mode is coming from a remote Sonar server. This means that those information have been computed during the latest analysis on that server.
- You will not see violations introduced in the code that you just added.
- Metrics (number of lines for example) will display values that will not match what you see in Eclipse if you added some code.
When switching to the local mode, information displayed is coming from the latest local analysis.
- You can see violations introduced in the code that you just added.
- Metrics (number of lines for example) will display values that will match what you see in Eclipse if you added some code.
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:
Features below will be tagged as Remote or/and Local depending on their availability.
The Sonar Eclipse Perspective
Sonar Eclipse provides one Eclipse perspective and four Eclipse views. Those Eclipse views can of course be used outside the Sonar Eclipse perspective, but this tutorial describes the default Sonar Eclipse perspective layout.
To activate the Sonar Eclipse perspective, click on Windows => Open Perspective => Other... and select Sonar:
The Measures View (Remote and Local)
The Measures view allows to gather all available measures on the selected ressource. Most of the time, developers focus their attention on only a few metrics like complexity, uncovered lines of code by unit tests, duplicated lines, etc. and want to get a quick overview on those metrics. That's why favourite metrics are displayed on the top of the Measures view. Adding or removing a metric from the Favourites list is possible by right clicking on the metric name:
The Violations View (Remote and Local)
The Violations view displays the list of violations of the selected resource (project, file, etc.):
The Hotspots View (Remote)
The Hotspots view allows to quickly identify hotspots on files according to favourite metrics (defined in the Measures view). You can for instance look at files with the greatest number of duplicated lines, the greatest number of violations, the greatest number of uncovered lines by unit tests, etc.
The Web View (Remote)
The Web view displays the web Sonar dashboard (for projects and packages) or the web Sonar ressource viewer (for files). This web page can be used to access information and services (cloud, treemap, ...) that are not yet natively available in Sonar Eclipse: