0

In my Spring Boot application I have placed the annotation:

 @SuppressWarnings("PMD.EmptyMethodInAbstractClassShouldBeAbstract")

However it seems Sonar is ignoring it as I'm still getting:

Empty method com.mycompany.DefaultService.validateData(String, PrimaryView, int, ServiceHelper) could be declared abstract

I've also tried placing the //NOPMD comment on the line and for that I'm getting:

 Remove usage of this "NOPMD" suppression comment filter.      NEW      squid:S1310

I'm new to Spring Boot, and I don't even see any Sonar plugins being specified in any of my POM files... Is it possible that my project is using an old version of Sonar and that's why these annotations/comments have no effect?

To invoke Sonar I'm using th following command:

mvn clean install sonar:sonar -DskipTests=true -Dsonar.language=java -Dsonar.analysis.mode=preview -Dsonar.host.url=http://susday10058.corp.mycompany.com:9000

I've also tried invoking it with -Dsonar.excludeMarker=NOPMD but that id not work either.

What am I missing?

Cœur
  • 37,241
  • 25
  • 195
  • 267
inor
  • 2,781
  • 2
  • 32
  • 42

1 Answers1

1

You should use SonarQube identifiers.

Change:

@SuppressWarnings("PMD.EmptyMethodInAbstractClassShouldBeAbstract")

to:

@SuppressWarnings("pmd:EmptyMethodInAbstractClassShouldBeAbstract")

Identifiers are visible in the right upper corner:

pmd:EmptyMethodInAbstractClassShouldBeAbstract description

agabrys
  • 8,728
  • 3
  • 35
  • 73
  • Thanks for yor response, but why does that not work for "pmd:GodClass"? i placed this just before the class eclaration... PMD seems to ignore it – inor Sep 26 '18 at 10:33
  • ok, i see that to supress the God Class issue you need to @SuppressWarnings("PMD.GodClass") eventhough PMD displays "pmd:GodClass" – inor Sep 26 '18 at 10:51