I am getting a lot code smells from lombok generated code in Sonar. F.E.:
Method Dto.hashCode() stores return result in local before immediately returning it
Dto.equals(Object) is excessively complex, with a cyclomatic complexity of 58
How can I point out sonar that this should be skipped from analyze?
UPDATE
I've tried it already. My lombok.config
file in root directory is:
config.stopBubbling = true
lombok.addLombokGeneratedAnnotation = true
lombok.equalsAndHashCode.callSuper = call
It doesn't helps
I've tried it already: sonarqube + lombok = false positives
I've updated: sonar-project.properties
in root directory to:
sonar.sources=src/main
sonar.tests=src/test
sonar.language=java
sonar.java.binaries=build/classes
sonar.junit.reportPaths=build/test-results/test/
sonar.jacoco.reportPaths=build/jacoco/jacocoTest.exec
sonar.java.libraries=.gradle/caches/**/lombok-*.jar
It doesn't work either.
Please don't close it. It is not duplication.
Methods generated by lombok need to be annotated with @Generated. Sonarqube will then ignore them.
Just add a file lombok.config
in the project root directory, with the following content:
lombok.addLombokGeneratedAnnotation=true
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With