Lukasz has posted 1 posts at DZone. View Full User Profile

Sonar and QAPlug integration

09.22.2011
| 6635 views |
  • submit to reddit

Have you ever think about using coding rules configured in the Sonar in the real-time analysis? Now, it is possible. It's really quick and easy. Just import the permalinks from the Sonar into the QAPlug.


The Sonar is an open source quality management platform, dedicated to continuously analyze and measure source code quality. It has several tools which allow to analyze code using the most popular coding rules like: Checkstyle, Findbugs and PMD. The Sonar violations utility provides a deep and extended code analysis and also gives the user a possibility to modify every checking rule. It is designed to scan the code of the project every time when it is rebuilded to keep user informed about the code condition. According to this characteristic, Sonar should be perceived more as a post diagnostic tool. It doesn't allow to check the code quality during the code development. So, what can you do when there is a need to scan code on-the-fly in the real-time mode?

The simpliest way is to use the QAPlug.

The QAPlug is a free and fully integrated Intellij IDEA plugin which helps to manage the code quality. It is really intuitive and user friendly tool, in which most of the operations can be performed with just a few mouse clicks. The plugin allows user to select a different code quality tools such as PMD, Checkstyle and Findbugs and offers extended scan reports. Moreover, it also gives the user a possibility to configure almost everything, from coding rules to exporting analysis profiles. But the most important feature of that plugin is the QAPlug Real-Time Analysis tool which allows the user to check the code quality in the real-time mode.

But what about the situation when you store a lot of customized coding rules in Sonar and want to use them in on-the-fly checks?

As it was mentioned before, QAPlug is fully configurable, so it also allows to define coding rules through an import from Sonar. By doing this, it is possible to activate the Sonar rules in the QAPlug Real-Time Analysis tool and check the written code on-the-fly. Real-time analysis marks the inappropriate lines of code and after placing mouse cursor on the highlighted line, it also shows the bug description.


QAPlug Real-Time Analysis tool.

Importing the Sonar rules into the QAPlug is very simple. All customized coding settings can be exported from Sonar using permalinks functionality.


Permalinks in Sonar.  

It means that there is no need to perform any complicated file export operations. Just right-click on the permalink and save it as an .xml file. After that, simply open the IntelliJ IDEA, go to the QAPlug settings and import .xml file to an existing or a new profile.

To see detailed instruction of how to import the Sonar rules into the QAPlug, go to this tutorial on the QAPlug website: Integrating Sonar with QAPlug

So, give your code a chance to be in the top league of quality and scan the code all the time using the Sonar rules in the QAPlug Real-Time Analysis tool!

For more information about QAPlug features please look at its website: qaplug.com

Published at DZone with permission of its author, Lukasz Chudy.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)