Versions Compared

Key

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

...

Sonar provides a quick and easy way to add new coding rules directly via the web interface for certain languages (C, C#, C++, Cobol, Flex, JavaScript, PL/I, PL/SQL, Python and PythonVB.NET).

The rules have to be written in XPath to navigate the Abstract Syntax Tree (AST). For each language, an SSLR Toolkit is provided to navigate the AST. This SSLR Toolkit is a standalone application that displays the AST for a provided piece of code source. So that you quickly get the nodes names and attributes to write your XPath expression from your code sample. The proper SSLR Toolkit can be downloaded from the language plugin page. So, finally, knowing the XPath language is the only prerequisite. A lot of tutorials on XPath can be found online (see http://www.w3schools.com/xpath/ for example).

...