I have a simple POJO class that has a isValid
method:
public class MyClass{
...
@ValidationMethod(message = "age must be ...")
@JsonIgnore
@SuppressWarnings("all")
public boolean isValid() {
return age > 10;
}
}
I like the SonarQube to ignore this method when it checks the project.
I don't like to remove all the test coverage checks in the project, but not to check this specific line.
So I added the @SuppressWarnings("all")
on top of the method, as suggested here and here. I also try to use the //NOSONAR
at the end of the line:
public boolean isValid() {
return age > 10;//NOSONAR
}
Yet, in both cases, the SonarQube ignores the suppress requests and gives an error about
"Not Covered by tests"
:
What are we missing here? Are there more settings to do in the SonarQube itself? Are we doing it wrong?