Giter Site home page Giter Site logo

sonarsource / slang Goto Github PK

View Code? Open in Web Editor NEW
88.0 25.0 30.0 6.7 MB

License: GNU Lesser General Public License v3.0

Java 84.58% ANTLR 0.37% HTML 5.04% Shell 0.28% Kotlin 0.01% Ruby 0.63% Scala 3.12% Go 5.85% Starlark 0.04% Makefile 0.03% Dockerfile 0.04%
language-team

slang's Introduction

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 documentation:

SLang (SonarSource Language) is a framework to quickly develop code analyzers for SonarQube to help developers write Clean Code.

SLang defines language-agnostic AST. Using this AST we can develop simple syntax-based rules. Then we use a parser for real language to create this AST. Currently, Ruby and Scala analyzers use this approach.

Ruby

We use whitequark parser to parse the 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 the 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 the Go language.

Have questions 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 builds. 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

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

./gradlew build -Pruling --info --no-daemon

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

./gradlew build -Pruling-scala --info --no-daemon

License headers

License headers are automatically updated by the spotless plugin but only for Java files. Furthermore, there are files such as package-info.java and module-info.java that spotless ignores. Also, Scala and Go source files are not handled. For those files use a manual script like below to update the license. E.g., for Go files (on Mac):

`find . -type f -name "*.go" -exec sed -i '' 's/2018-2023/2018-2024/' "{}" \;`

slang's People

Contributors

aborg0 avatar adarko22 avatar alban-auzeill avatar amelie-renard-sonarsource avatar andrea-guarino-sonarsource avatar andreaguarino avatar andrei-epure-sonarsource avatar chrislain-razafimahefa-sonarsource avatar christophe-zurn-sonarsource avatar costin-zaharia-sonarsource avatar david-cho-lerat-sonarsource avatar dorian-burihabwa-sonarsource avatar drautureau-sonarsource avatar erwan-serandour-sonarsource avatar godin avatar johann-beleites-sonarsource avatar julien-carsique-sonarsource avatar kaufco avatar leonardo-pilastri-sonarsource avatar leveretka avatar marcelo-sousa-sonarsource avatar margarita-nedzelska-sonarsource avatar matemoln avatar mpaladin avatar pynicolas avatar quentin-jaquier-sonarsource avatar saberduck avatar tomverin avatar vilchik-elena avatar wohops avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.