SonarQube + lombok says removed unused private field

Hey Sonar, my company is using SonarQube(Developer Edition - Version 10.4.1) and using lombok annotation for our entities. But when it comes to the sonarqube report it says:

Unused “private” fields should be removed

So we have added this content in our lombok.config file for all our repositories:

# This tells lombok that this directory is the root.
config.stopBubbling = true

# Add the @lombok.Generated annotation to all the code generated by Lombok, so it can be excluded from code coverage.
lombok.addLombokGeneratedAnnotation = true

But even with this added the same issue happens and one of the repository the coverage dropped by 0.2%

We want to avoid SonarQube from scanning lombok annotations and creating issues related to it

Hey there.

This issue (SONARJAVA-4933) should be fixed in the upcoming SonarQube 10.6.

For now you can mark the issues as false-positives, or turn off the rule if it is too noisy.

Ah I see. Thank you so much

Sure thing

Wanted to ask, we will still need the lombok.config file?

Hey there.

My understanding is that this configuration only related to calculating coverage (something JaCoCo will do, and SonarQube only imports the report of).

So you probably want to keep it here.

It will not affect the execution of Sonar rules.

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