Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sonarqube bad coverage because of lombok @Data

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 @Dataannotation 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 ?

like image 837
Martin Choraine Avatar asked Aug 08 '17 13:08

Martin Choraine


Video Answer


1 Answers

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

like image 143
Vlad Schnakovszki Avatar answered Oct 15 '22 23:10

Vlad Schnakovszki