I use jacoco for coverage report. When I look at the jacoco report, coverage seems to be good. But in Sonarqube, the coverage is low because it says that @Data
annotation from lombok is not cover by test.
Compiled classes is mark as @Generated
but it's not ignored by Sonar.
How can I make exclude @Data
of the analysis ?
Godin's answer is correct but there is now a way to add that annotation automatically.
In order to do this you can create a lombok.config
file in the root of your project and add this line in it:
lombok.addLombokGeneratedAnnotation = true
Full details here. As detailed in the documentation:
Lombok can be configured to add @lombok.Generated annotations to all generated nodes where possible; useful for JaCoCo (which has built in support), or other style checkers and code coverage tools: lombok.addLombokGeneratedAnnotation = true