sonarqube 4.2和龙目岛 [英] sonarqube 4.2 and lombok
问题描述
将SonarQube从4.0升级到4.2之后,我从带有Lombok批注的类中得到了一堆未使用的私有字段应删除"错误.
After upgrading SonarQube from 4.0 to 4.2, I got a bunch of 'Unused private fields should be removed' errors from the classes with Lombok annotations.
我有
@SuppressWarnings("PMD.UnusedPrivateField")
在所有这些类的开头声明.当我使用SonarQube 3.7和4.0时,效果很好.
declared at the beginning of all those classes. It worked fine when I was using SonarQube 3.7 and 4.0.
我用
mvn sonar:sonar
生成SonarQube报告.
to generate the SonarQube report.
这显示了我的班级样子:
And this shows how my class look like:
@Data
@SuppressWarnings("PMD.UnusedPrivateField")
public class MyClass {
private String field;
}
如何摆脱4.2版中的这些错误?谢谢.
How can I get rid of those errors in version 4.2? Thanks.
推荐答案
内部SonarQube规则squid:S1068
生成的消息是未使用的私有字段应删除",而您的@SuppressWarnings
批注将禁用匹配(并且不建议使用)PMD检查.
'Unused private fields should be removed' is the message generated by the internal SonarQube rule squid:S1068
, whereas your @SuppressWarnings
annotation disables the matching (and deprecated) PMD check.
您可能想检查您的质量档案,最终禁用此规则,或为Lombok增强类添加一些排除项.
You might want to check your quality profile, eventually disable this rule, or put some exclusions for the Lombok augmented classes.
这篇关于sonarqube 4.2和龙目岛的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!