Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Steps to cover a new language

...

  1. Write the grammar

...

  1. . This is the hardest part.

...

  1. Write a parser (a parser simply takes a grammar, an input, and will parse it, yielding a parse tree)

...

  1. .

...

  1. Test your grammar, to ensure it is able to parse your real-life language files.

...

  1. 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.

...

  1. Write a SonarQube sensor

...

  1. to launch the visitors. It should query 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.
PHPSquidSensorSee also: SSLR.java

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 MULTIPLE
  • To access a constant from a Java class in a .erb file, use Java::OrgSonarPluginsPlug::MyConfiguration::MY_CONSTANT 

...