SLang :: ANTLR

Parent pom of SonarSource public projects

License

License

Categories

Categories

Ant Build Tools ANTLR Compiler-compiler
GroupId

GroupId

org.sonarsource.slang
ArtifactId

ArtifactId

slang-antlr
Last Version

Last Version

1.0.0.928
Release Date

Release Date

Type

Type

jar
Description

Description

SLang :: ANTLR
Parent pom of SonarSource public projects
Project Organization

Project Organization

SonarSource

Download slang-antlr

How to add to project

<!-- https://jarcasting.com/artifacts/org.sonarsource.slang/slang-antlr/ -->
<dependency>
    <groupId>org.sonarsource.slang</groupId>
    <artifactId>slang-antlr</artifactId>
    <version>1.0.0.928</version>
</dependency>
// https://jarcasting.com/artifacts/org.sonarsource.slang/slang-antlr/
implementation 'org.sonarsource.slang:slang-antlr:1.0.0.928'
// https://jarcasting.com/artifacts/org.sonarsource.slang/slang-antlr/
implementation ("org.sonarsource.slang:slang-antlr:1.0.0.928")
'org.sonarsource.slang:slang-antlr:jar:1.0.0.928'
<dependency org="org.sonarsource.slang" name="slang-antlr" rev="1.0.0.928">
  <artifact name="slang-antlr" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.sonarsource.slang', module='slang-antlr', version='1.0.0.928')
)
libraryDependencies += "org.sonarsource.slang" % "slang-antlr" % "1.0.0.928"
[org.sonarsource.slang/slang-antlr "1.0.0.928"]

Dependencies

compile (3)

Group / Artifact Type Version
org.antlr : antlr4 jar 4.7.1
org.sonarsource.slang : slang-api jar 1.0.0.928
org.sonarsource.analyzer-commons : sonar-analyzer-commons jar 1.8.0.295

test (3)

Group / Artifact Type Version
org.sonarsource.slang : slang-testing jar 1.0.0.928
junit : junit jar 4.12
org.assertj : assertj-core jar 3.6.1

Project Modules

There are no modules declared in this project.

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.

Scala coverage

For Scala files, we will import both Scoverage and JaCoCo coverage reports. Note that this will result in strange behavior since:

  • Only line coverage will be used from the Scoverage report.
  • JaCoCo can be imprecise when computing conditions coverage on Scala code, generating FP (typically on pattern matching).

This situation only applies to two Scala files, this current situation is acceptable.

Go

We use the native Go parser to parse Go language.

Have question or feedback?

To provide feedback (request a feature, report a bug etc.) use the SonarQube Community Forum. Please do not forget to specify the language, plugin version and SonarQube version.

Building

Setup

If you are on Windows, read the sonar-go-to-slang/README.md instructions.

SonarSource internal usage: Configure your gradle.properties - read the private/README.md instructions.

Build

Build and run Unit Tests:

./gradlew build

Integration 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 its property:

./gradlew build -Pits --info --no-daemon -Dsonar.runtimeVersion=7.9

You can also build and run only Ruling Tests using the ruling property:

./gradlew build -Pruling --info --no-daemon -Dsonar.runtimeVersion=7.9

If you want to run ruling tests for specific language, you can use ruling-{lang} property (ruling-kotlin, ruling-scala, ruling-ruby, ruling-go). For example:

./gradlew build -Pruling-kotlin --info --no-daemon -Dsonar.runtimeVersion=7.9

License headers

Note: The license check is not working correctly, see SONARSLANG-367.

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:

./gradlew licenseFormat
org.sonarsource.slang

SonarSource

Continuous Code Quality

Versions

Version
1.0.0.928