SONAR: Tool for Maintaining Coding Standards and Conventions
SONAR is an open source platform used by development teams to manage source code quality. Sonar has been developed with this main objective in mind: make code quality management accessible to everyone with minimal effort.
Sonar provides code analyzers, reporting tools, manual reviews, defect-hunting modules, and TimeMachine as core functionalities. It also comes with a plugin mechanism enabling the community to extend the functionality, making Sonar the one-stop-shop for source code quality by addressing not only the developer’s requirements, but also the manager’s needs.
Coding standards are defined by sets of rules governing programming style for a particular programming language. Although they differ from language to language, the objective is the same—to provide consistent, clean, readable code. Of course, development teams have different requirements and develop their own rule sets customized to their own preferences and programming habits. However, while the coding standards matter is subjective, the goal remains the same and many common rules apply to all projects among different programming languages.
Features of SONAR:
1. Offers reports on duplicated code, coding standards, unit tests, code coverage, complex code, potential bugs, comments and design and architecture.
Why to use SONAR?
Most mature software development companies or departments define their coding standards. The intentions is simple; ensure all code looks alike to ease reading, writing, maintaining and communicating code. As a first effort, these coding conventions may be expressed in some form of standalone document, but conventions that are not being enforced are simply a waste of time. In this case SONAR is very helpful which can enforce these coding standards to developers and management.
Components of SONAR
Sonar is made of a fairly simple and flexible architecture that consists of three components:
1. A set of source code analyzers that are grouped in a Maven plugin and are triggered on demand. The analyzers use configuration stored in the database. Although Sonar relies on Maven to run analysis, it is capable to analyze Maven and non-Maven projects.
2. A database to not only persist the results of the analysis, the projects and global configuration but also to keep historical analysis for TimeMachine. 5 database engines are currently supported : Oracle, MySQL, Derby (demo only), PostgreSQL and MS SQLServer.
3. A web reporting tool to display code quality dashboards on projects, hunt for defects, check TimeMachine and to configure analysis.