name.remal.sonarlint

Plugin class: name.remal.gradle_plugins.plugins.code_quality.sonar.SonarLintPlugin

plugins {
    id 'name.remal.sonarlint' version '1.0.203'
}
plugins {
    id("name.remal.sonarlint") version "1.0.203"
}

 

This plugin executes SonarLint inspections without connecting to a SonarQube server. SonarLint's core JARs and plugins' JARs are downloaded via sonarlintCore and sonarlintPlugins configurations accordingly.

To resolve dependencies, the plugin adds SonarSource Maven repository to the project's repositories.

By default, the plugin uses these Sonar plugins:

 

If java Gradle plugin is applied, sonarlint* task is created for each SourceSet.

The plugin creates sonarlint extension of type SonarLintExtension (it extends CodeQualityExtension) that allows to configure sonarlint* tasks globally.

 

Usage:

sonarlint {
    ignoreFailures = false
    excludes {
        message 'squid:S1214'
        message 'squid:S1172'
        message 'kotlin:S1192'
        message 'kotlin:S1066'
        message 'kotlin:S100'
        message 'kotlin:S101'
        message 'kotlin:S1135'
        message 'xml:S125'
    }
}
import name.remal.gradle_plugins.plugins.code_quality.sonar.SonarLintExtension

configure<SonarLintExtension> {
    isIgnoreFailures = false
    excludes {
        message("squid:S1214")
        message("kotlin:S100")
        message("kotlin:S101")
    }
}

 

name.remal.gradle_plugins.plugins.code_quality.sonar.SonarLintExtension

Property Type Description
excludes ExcludesExtension Global excludes.
sonarProperties MutableMap<String, String?> Extra Sonar properties.
Method Description
void sonarProperty(Object? name, Object? value) Adds new Sonar property.
void sonarProperties(Map<Object?, Object?> map) Copy Sonar properties from the map.

name.remal.gradle_plugins.plugins.code_quality.ExcludesExtension

Property Type Description
sources MutableSet<String> ANT like exclude patterns of source files.
messages MutableSet<String> Violation messages to exclude.
Method Description
void source(String value) Add ANT like exclude pattern of source files.
void sources(String... values) Add ANT like exclude patterns of source files.
void sources(Iterable<String> values) Add ANT like exclude patterns of source files.
void message(String value) Add violation message to exclude.
void messages(String... values) Add violation messages to exclude.
void messages(Iterable<String> values) Add violation messages to exclude.