2

we're using SonarQube zu analyze our Codebase and sometimes just have to use the @SuppressWarnings-Annotation to mark Issues in SonarQube as false positives.

Of course we'd like to limit the use of this Annotation to defined cases and dissallow it for certain SonarQube rules alltogehter (as it shouldn't be easily used to bypass any rules).

So, we're thinking to scan and analyze @SuppressWarnings with jqAssitant to find disallowed usages.

However the Annotation doesn't seem to be present in jqAssistant after scanning, my guess because of RetentionPolicy.SOURCE used by SuppressWarnings:

@Retention(RetentionPolicy.SOURCE)
public @interface SuppressWarnings {

Is there any way to include the Annotation in the scan results?

Thanks, Tom

tom
  • 1,455
  • 1
  • 8
  • 13

1 Answers1

1

jQA currently only scans the bytecode of Java classes, for this annotation we would need a source code scanner. So the only chance I see at this moment is to define your own annotation with retention RUNTIME and filter on that.

Dirk Mahler
  • 1,186
  • 1
  • 6
  • 7
  • Ok, thanks for the Info! The problem I see with a custom annotation is that SonarQube probably won't honor that. – tom Mar 27 '17 at 06:44