remal-gradle-plugins / sonarlint

A plugin that executes SonarLint checks without SonarQube server
MIT License
18 stars 2 forks source link

isGeneratedCodeIgnored does not interfere #106

Closed khauser closed 1 year ago

khauser commented 1 year ago

With this build.gradle

id 'name.remal.sonarlint' version '3.0.9'

sonarLint {
    isGeneratedCodeIgnored = true
}

dependencies {
    ...
    implementation 'com.querydsl:querydsl-core'
    implementation 'com.querydsl:querydsl-jpa'

    annotationProcessor("com.querydsl:querydsl-apt:${dependencyManagement.importedProperties['querydsl.version']}:jpa")
    annotationProcessor("jakarta.persistence:jakarta.persistence-api")

The generated Classes from querydsl are annotated with javax.annotation.processing.Generated. The flag isGeneratedCodeIgnored=true is now ending in:

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':sonarlintMain'.
> A failure occurred while executing name.remal.gradle_plugins.sonarlint.SonarLintAction
   > File [uri=file:///<our project path>/build/generated/sources/annotationProcessor/java/main/<one of our querydsl file path>] can't be indexed twice.

I would expect that the generated Classes would be ignored by sonarlint. Can you help here?

remal commented 1 year ago

@khauser please try plugin version 3.0.10.

To be honest, I'm not exactly sure what the root cause is. If upgrading to version 3.0.10 doesn't help, I'll have to ask you to create a reproducible example.

khauser commented 1 year ago

Looks much better now. Thanks remal