This is a developer documentation. If you want to analyze source code in SonarQube read one of the following documentations:
- Kotlin language: SonarKotlin documentation
- Ruby language: SonarRuby documentation
- Scala language: SonarScala documentation
SLang (SonarSource Language) is a framework to quickly develop code analyzers for SonarQube. SLang defines language agnostic AST. Using this AST we can develop simple syntax based rules. Then we use parser for real language to create this AST. Currently Kotlin, Ruby and Scala analyzers use this approach.
We use whitequark parser to parse Ruby language by embedding it using JRuby runtime.
- AST documentation for the parser can be found here
- We use simple Ruby script to call the parser and invoke our visitor written in Java
We use Scalameta to parse Scala language.
Build and run Unit Tests:
By default, Integration Tests (ITs) are skipped during build. If you want to run them, you need first to retrieve the related projects which are used as input:
git submodule update --init its/sources
Then build and run the Integration Tests using the
./gradlew build -Pits --info --no-daemon -Dsonar.runtimeVersion=7.4
When adding a new source file, you will need to add license headers. Instead of copy-pasting blocks, the following command line can be used: