Persistent properties are also accessible from the Web Service named 'properties'. To exclude some properties from anonymous requests, add the suffix ".secured" to the key (
my.property.secured). It can be useful for license keys for example.
Steps to cover a new language
First, you must write the grammar, which is the hardest part. As an example, here is the PHP grammar. The next step is to write a parser (a parser simply takes a grammar, an input, and will parse it, yielding a parse tree): The PHP parser.
After that, you should be able to test your grammar, to ensure it is able to parse your real-life language files.
Then, you typically write a few parse tree visitors. Some visitors will compute metrics, while others will enforce coding rules. A dozen or so visitors is sufficient for an initial release.
Finally, those visitors are launched from a SonarQube sensor, which queries the API to get the list of source files, the list of active coding rules in the quality profile, and the API to save metrics and issues.
Tips and Tricks
- For generating charts use d3.js, which is packaged with SonarQube since version 4.1.
- To create "template" rules (rules that can be duplicated by the user) set the rule's
cardinality field to
- To access a constant from a Java class in a .erb file, use J