Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SonarQube Lombok Getter recognition

I am using SonarQube 4.5.4 with Java plugin 3.1. As I know this sonar-java version supports Lombok partially (Getter and Setter annotations) starting from 2.8.
But in my case it still reports field with lombok.Getter as:

squid:S1068  Unused private fields should be removed:
@Getter
private String userName;

Do you have any ideas why this could happen and where can I fix it?

update

For bytecode I tried both sonar.java.binaries and sonar.binaries I use sbt and run analysis with sonar-runner for below sonar-project.properties

sonar.projectVersion=0.1
sonar.java.binaries=\
    target/scala-2.11/classes,\
    target/scala-2.11/test-classes

sonar.sourceEncoding=UTF-8

sonar.projectName=projectName  
sonar.host.url=http://hostname:9000  
sonar.login=login  
sonar.password=password  
sonar.projectKey=projectKey:webJava  
sonar.modules=app  
app.sonar.projectBaseDir=web  
app.sonar.sources=app  
app.sonar.tests=test

sonar.analysis.mode=preview  
sonar.issuesReport.lightModeOnly=false
like image 226
Librael Avatar asked Feb 11 '23 05:02

Librael


1 Answers

You have to provide the 3rd party libraries you use (ie your classpath) via sonar.java.libraries property for the analyzer to be able to detect that you are using Lombok and make the correct exclusions.

like image 146
benzonico Avatar answered Mar 03 '23 21:03

benzonico