There is the way to exclude getter and setters from sonar report. Suppose I have 2 "getters":
public int getId(){
return this.id;
}
public int getComplexId(){
int result = 0;
// some complex calculation there
return result;
}
It is possible to exclude getId() and include getComplexId() simultaneously? Can Sonar analyze simple return this.id from complex code?
You can use NOPMD comment to avoid Sonar analysis.
public int getId(){ // NOPMD
return this.id;
}
public int getComplexId(){
int result = 0;
// some complex calculation there
return result;
}
Also you can use //NOSONAR or //CHECKSTYLE:OFF comment. More info in http://www.sonarqube.org/sonar-1-12-in-screenshots/
@Cherry, out of the box SonarQube already behaves as expected : the first method is considered as a getter and not the second one as this method contains some logic.