SonarQube Lombok Getter recognition

守給你的承諾、 提交于 2019-12-07 06:59:45

问题


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

回答1:


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.



来源:https://stackoverflow.com/questions/30073532/sonarqube-lombok-getter-recognition

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!