有的是way http://skitch-img.s3.amazonaws.com/20100903-ekunteuietuq9j394prku9d37t.jpg从声纳报告中排除 getter 和 setter。假设我有 2 个“吸气剂”:
public int getId(){
return this.id;
}
public int getComplexId(){
int result = 0;
// some complex calculation there
return result;
}
有可能excludegetId() 和include同时 getComplexId() 吗? Sonar 可以分析复杂代码中的简单返回 this.id 吗?
您可以使用 NOPMD 注释来避免 Sonar 分析。
public int getId(){ // NOPMD
return this.id;
}
public int getComplexId(){
int result = 0;
// some complex calculation there
return result;
}
您也可以使用 //NOSONAR 或 //CHECKSTYLE:OFF 注释。更多信息在http://www.sonarqube.org/sonar-1-12-in-screenshots/ http://www.sonarqube.org/sonar-1-12-in-screenshots/
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)