Once the installation of Sonar is complete, you are ready to launch analyses on your projects.
What does Sonar analyze?
Sonar performs a static analysis of your code.
Sonar analyzes 15+ languages. The code that is analyzed may be:
- Source code (.java files in Java, Cobol programs, etc.)
- Compiled code (.class files or jars in Java, dll files in C#, etc.)
By analyzing your code, the Sonar engine:
- Computes measures (lines of code, cyclomatic complexity, etc.) at different levels (file, module, project, application portfolio, etc.)
- Detects violations (non-respects of coding standards)
For some languages (like Java or C# for example), Sonar can also provide information on automated unit and integration tests like number of failing tests, code coverage, etc.
How to launch an analysis?
For a project embedding different languages, each of them needs to be analyzed by running its own Sonar analysis. Then the results can be aggregated at project level, using the Views plug-in.
There are several ways to run a Sonar analysis:
- using the Sonar Runner: recommended for non-Java projects
- using the Maven Plugin: recommended for Java projects built with Maven
- using the Ant Task: recommended for Java projects built with Ant
- using a CI engine
A series of advanced parameters is available when running analysis.