Skip to content

Document correct Report generate Gradle Kotlin configuration, and small questions #7

@scscgit

Description

@scscgit

Documentation should be updated.

On page https://github.com/Lucas3oo/sonarlint-gradle-plugin?tab=readme-ov-file#sonarlint-ci-reports there is an example:

sonarlintMain {
  reports {
    xml.enabled = true // default false
    sarif.enabled = true // default false
  }
}

It doesn't work with Gradle 8.9 when using Kotlin syntax, i.e. file build.gradle.kts. I made it work as follows:

plugins {
    id("se.solrike.sonarlint") version "2.0.0"
}
dependencies {
    sonarlintPlugins("org.sonarsource.java:sonar-java-plugin:8.2.0.36672")
}
tasks.sonarlintMain {
    ignoreFailures = false
    reports {
        reports.create("xml") {
            enabled = true
            outputLocation = layout.buildDirectory.file("reports/sonarlint/sonarlint.xml")
        }
        reports.create("html") {
            enabled = true
            outputLocation = layout.buildDirectory.file("reports/sonarlint/sonarlint.html")
        }
    }
}

(Note: tasks.sonarlintMain<se.solrike.sonarlint.Sonarlint> also works.)

Also, I'd like to ask how is it possible to change the minimum level in failures/reports. For example, I want Major️ and Minor but not Info. Can this be documented?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions