Coder Social home page Coder Social logo

sonarsource / sonar-scanner-gradle Goto Github PK

View Code? Open in Web Editor NEW
176.0 43.0 90.0 1.36 MB

SonarQube Scanner for Gradle

Home Page: https://redirect.sonarsource.com/doc/gradle.html

License: GNU Lesser General Public License v3.0

Groovy 21.18% Java 77.07% Shell 0.63% JavaScript 0.01% Dockerfile 0.44% Starlark 0.04% Kotlin 0.63%
gradle-plugin

sonar-scanner-gradle's Introduction

SonarScanner for Gradle

Build Status Quality Gate

About Sonar

Sonar's Clean Code solutions help developers deliver high-quality, efficient code standards that benefit the entire team or organization.

User documentation

https://redirect.sonarsource.com/doc/gradle.html

Have Questions or Feedback?

For support questions ("How do I?", "I got this error, why?", ...), please head to the SonarSource forum. There are chances that a question similar to yours has already been answered.

Be aware that this forum is a community, so the standard pleasantries ("Hi", "Thanks", ...) are expected. And if you don't get an answer to your thread, you should sit on your hands for at least three days before bumping it. Operators are not standing by. :-)

Contributing

If you would like to see a new feature, please create a new thread in the forum "Suggest new features".

Please be aware that we are not actively looking for feature contributions. The truth is that it's extremely difficult for someone outside SonarSource to comply with our roadmap and expectations. Therefore, we typically only accept minor cosmetic changes and typo fixes.

With that in mind, if you would like to submit a code contribution, please create a pull request for this repository. Please explain your motives to contribute this change: what problem you are trying to fix, what improvement you are trying to make.

Make sure that you follow our code style and all tests are passing (Travis build is executed for each pull request).

Developer documentation

Building the project

To build the plugin and run the tests, you will need Java 11.

./gradlew clean build

How the plugin works

When the plugin is applied to a project, it will add to that project the Sonar task. It will also add to the project and all its subprojects the Sonar extension. For multi-module projects, the plugin will only apply to the first project where it gets called. The goal is to allow the usage of allprojects {}, for example.

Sonar extension The sonar extension enables an easy configuration of a project with the Domain Specific Language.

Sonar task The Sonar task has the name sonar, so it can be executed by calling ./gradlew sonar. It collects information from the project and all its subprojects, generating the properties for the analysis. Then, it runs the SonarScanner analysis using all those properties. The task depends on all compile and test tasks of all projects (except for skipped projects). If all projects are skipped (by adding skipProject=true to the sonar DSL), the analysis won't execute.

Using the plugin directly in a project (no need to build/install it in advance)

A composite build can be used to substitute plugins with an included build.

In the target project, apply the sonarqube plugin:

plugins {
  id 'org.sonarqube'
}

Run with:

./gradlew sonar --include-build /path/to/sonar-scanner-gradle

Debugging the plugin

See the previous point about including the plugin's build when building a target project. To debug, simply add the parameter:

./gradlew sonar --include-build /path/to/sonar-scanner-gradle -Dorg.gradle.debug=true

Now debug remotely by connecting to the port 5005.

Integration Tests

By default, Integration Tests are skipped during the build. To run them, you need to follow these steps:

  • Install the SNAPSHOT version of the root project in the local Maven repository.
  • Import the integationTests project as a Maven project and ensure that Android SDK is set.
  • Set ANDROID_HOME environment variable
  • Run the following command from the integrationTests project:
    mvn --errors --batch-mode clean verify
    

Install a SNAPSHOT in the local Maven repository

./gradlew publishToMavenLocal

Using the plugin SNAPSHOT previously installed in the local Maven repository

buildscript {
    repositories { 
      mavenCentral()
      mavenLocal()
    }
    dependencies { classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:<THE VERSION>' }
}

apply plugin: 'org.sonarqube'

Release and deploy on Gradle plugin repository

Follow the Scanner for Gradle Release Process

https://plugins.gradle.org/docs/publish-plugin

./gradlew release

License

Copyright 2011-2024 SonarSource.

Licensed under the GNU Lesser General Public License, Version 3.0)

sonar-scanner-gradle's People

Contributors

adarko22 avatar alban-auzeill avatar berndfarkadyna avatar dbmeneses avatar dependabot[bot] avatar dorian-burihabwa-sonarsource avatar drautureau-sonarsource avatar ehartmann avatar friederbluemle avatar ganncamp avatar henryju avatar irina-batinic-sonarsource avatar jacek-poreda-sonarsource avatar julien-carsique-sonarsource avatar kaufco avatar leo-geoffroy-sonarsource avatar leonardo-pilastri-sonarsource avatar leveretka avatar lukasz-jarocki-sonarsource avatar malena-ebert-sonarsource avatar michal-duda-sonarsource avatar mihaiparv avatar mikejhill avatar nikola-paysafe avatar saberduck avatar tobias-trabelsi-sonarsource avatar tomverin avatar wouter-admiraal-sonarsource avatar wyhasany avatar zipengwu 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  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  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.