SonarQube doesn't recognize lombok getters

We use lombok plugin:
-io.freefair.lombok" version “5.3.3.3” for getters and setters for our project, and
Sonar plugin
-‘org.sonarqube’ version ‘3.1.1’
in build.gradle for our project
with java 8
gradle version: 6.8.3
Now issue is when we merge code with main branch with any new variable added say for eg
@Getters
private String testLombok;
and xxxx.getTestLombok();
, it goes through sonarqube analysis and it give a code smell like
Remove this unused “testLombok” private field.

Is there any solution to this ?
I have tried updating the plugin version to 3.3 but it doesn’t resolve it.

Hello @Sumee_Goel

I have a few questions:

Are you really using @Getters? Or is it @Getter? Could you tell me the fully qualified name (name of the import), to be sure we are talking about the same thing?

Which version of Sonarqube are you using?

Thanks.

We are using @Getter. but to answer my own question: I have fixed this issue by following the suggestion mentioned in:

we added the copyDependency step/gradle task which runs in Sonarqube test stage and SonarQube is able to pick it up now and we added:
sonar.java.libraries=build/libs,build/dependencies

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.