Skip to content

quentin-jaquier-sonarsource/slang

 
 

Repository files navigation

SLang

Build Status Quality Gate Coverage

This is a developer documentation. If you want to analyze source code in SonarQube read one of the following documentations:

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.

Kotlin

We use embeddable library of Kotlin compiler to create AST and visitor to create SLang AST.

Ruby

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

Scala

We use Scalameta to parse Scala language.

Building

Run:

mvn clean install

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

Then run the ITs

cd its
mvn clean install -Dsonar.runtimeVersion=7.1

License headers

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:

mvn license:format

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 91.4%
  • HTML 5.7%
  • Scala 1.6%
  • Ruby 0.5%
  • ANTLR 0.5%
  • Kotlin 0.3%