Sonar light: the low-calorie mode for Sonar
When I initially wrote this blog entry, I chose a much more original title : "What is the analogy between a Coke light and Sonar light". But then I realized that "Coca Light" (the French for Diet Coke) does not translate to "Coke light"... The title was not as attractive anymore : I had to back up ! ;-)
As any good code analysis tool, Sonar performs static as well as dynamic analysis (code coverage by unit tests). The dynamic analysis requires a lot of processing power (calories burning) since the unit components of the program must be compiled before they can be executed. On the contrary, static analysis just needs to analyze source code in order to calculate metrics like cyclomatic complexity or to detect bad coding practices.
Further more, the dynamic analysis in Sonar requires that the project is "mavenized" in order to have a list of runtime dependencies. Since there are still a few projects around that are not mavenized yet, the demand was growing for a way of using Sonar on those projects.
Those two reasons were good enough to create Sonar light, a mode without dynamic analysis and that does not require your project runs under maven.
A live example of Sonar light is the Tomcat project in Nemo.
Practically, in order to run analysis on a project in the light mode, you only need the simplest possible pom.xml placed in the root of your project :
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
Launch Sonar Maven goal mvn org.codehaus.sonar:sonar-maven-goal:1.X:sonar and go to the Sonar web interface to see the results.
Coming back to the initial title : in both cases you are using a low-calorie product.