Friday, 10 July 2015

Do you know the Quality of your code ?

Integrate SONAR with Eclipse

Eclipse Sonar Plug-In Installation

Eclipse Integration (To install this plugin in the Eclipse IDE)  - With Eclipse Market Place

Figure 9 - Sonar Eclipse Plug-in Install (Market Place)

Figure 10 - Sonar Eclipse Plug-in Install (Market Place) II

Eclipse Integration (To install this plugin in the Eclipse IDE)  - With Eclipse Software Update

Go to Help > Install New Software... This should display the Install dialog box.
Paste the Update Site URL (http://dist.sonar-ide.codehaus.org/eclipse/) into the field Work with and press Enter. This should display the list of available plugins and components:

Figure 11- Sonar Eclipse Plug-in Install (With Install New Software Menu)
Choose Sonar Java, follow the steps and install the plugin
Note: Please make sure the project that you want to associate with sonar has already analyzed in your sonar installation

Configure Sonar in your Eclipse

Configure your local/remote sonar in your Eclipse
Go to Window > Preferences > Sonar > Servers.
Sonar Eclipse is pre-configured to access a local Sonar server listening on http://localhost:9000/. You can edit this server, delete it or add a new one.

Figure 12 - Configure Sonar Server in Eclipse

Link your project for the first time

Once the Sonar server is defined, the next step is to link your Eclipse projects with projects defined and analyzed on this Sonar server.
To do so, right-click on the project in the Project Explorer, and then Configure > Associate with Sonar...:

Figure 13 - Configure / Associate your Eclipse Project with Sonar
In the Sonar project text field, start typing the name of the project and select it in the list box:

Figure 14 - Associate your Eclipse Project with Sonar II
Click Finish. Your project is now associated to one analyzed on your Sonar server.

Analyze and clean up the code violations

Do local analysis and clean the violations

Figure 15 - Configure Modules

Figure 16 - configure sonar modules from Eclipse
Note
Please make sure you have started your local sonar server (as described in Run sonar section) otherwise you would not able to see the right sonar project that you intend to configure

Run Sonar Analysis in Local


Figure 17.a – Set Sonar Analysis on Local Mode

Figure 17:b - Run Sonar Analysis on Local

Figure 18 - sonar violation analysis console

Figure 19 - Sonar violation analysis console II

Figure 20 - Sonar violations Markers

No comments:

Post a Comment