The Sonar plugins forge is up and running !
Amongst Sonar built-in strengths, we mentioned extensibility several times without giving many details. Time has come to discuss it further as anyone can now easily contribute to the Sonar plugins ecosystem.
We do know extensibility of a tool is a key aspect to get it widely adopted. That is why we built Sonar around a very light core that consists mainly in an extension mechanism. Everything else in Sonar is a plugin. However, having such a mechanism in place is only one step amongst four to reach extensibility and leverage this capability :
- An easy to use API
- A forge
- An active community
- A "Getting started" documentation with examples
We believe that we have today a sufficient base on all four points.
An easy to use API
A Sonar plugin is nothing more than a jar that contains several POJOs (Plain Old Java Objects). Once packaged, this jar must be copied to the /extensions/plugins directory of the Sonar web server in order to be loaded at next start. This jar must contain an extension container "MyOwnPlugin" that implements the org.sonar.plugins.api.Plugin interface. From there, it possible to optionally define the following extensions :
- New metrics ("MyMetrics") such as number of open bugs, number of GreenPepper tests, class dependencies
- New repository of coding rules ("MyRuleRepository") that will be added to the existing ones such as tag 'TODO' is forbidden, package com.mycompany.web should not access package **/sql/**.
- New sensor ("MyMavenCollector") to collect metrics such as cyclomatic complexity on C# source code
- New maven plugin handler ("MyMavenHandler") if the sensor need first to execute an existing Maven Plugin such as JDepend in order to collect the generated xml report
- New consolidation job ("MyJob") to calculate second level metrics such as Technical Debt or percentage of public method with javadoc
- New GWT web page ("MyPage") to display for example a full page treemap with a second level of information or a motion chart
- New GWT component ("MyResourceViewer") to display a new tab in the source viewer
The API will obviously continue evolving to embark new functionality. However, because we eat our own food and it has been tested with the various plugins that come with Sonar such as Checkstyle, Surefire, JavaNCSS, Clover, Findbugs..., we think the API is mature.
Having a forge enables to ease greatly the development process for contributors. Further more, by centralizing the development place, it enables to better control changes in the core that could impact plugins. As for Sonar, the Sonar plugins are being hosted at Codehaus and therefore benefit from one of the best possible infrastructure : Jira, Subversion, Confluence and Sonar development mailing list. All this is ready since last week. We will grant access to anybody who requests it.
If you wish to develop your own plugins, the Sonar plugins forge is now up and running !
An active community
Even if Sonar is still a young product, the community has grown a lot in the past 6 months. Last month Sonar was downloaded 2,000 times and we are proud today to report around 150 users registered on the user mailing list, 40 on the development mailing list and 250 people subscribing to the blog daily. Thanks to all those Sonar early adopters ! By putting the extension mechanism in place, the community will be able to put its hands on the tool and therefore leverage the development of new features (at least, we hope so :-)).
Documentation and examples
In the software development world, it is pretty much impossible to write a documentation without an "Hello World" example. We've respected this cultural rule by providing a tutorial and the source code of this mythic "Getting Started" example. Documentation of the plugin architecture, web services... is available in the Sonar Confluence space. Along with the documentation come several example plugins that can be copied as a starting point (Taglist, Emma and PHP).
Everything is in place and ready for community contribution to Sonar. Here are a few ideas of plugins that the current extension mechanism enables to deliver autonomously :
- Integrate the Testability Explorer
- Create a second-level metric to compute a Technical Debt
- Cover a new language like .Net
Have fun with Sonar plugins !