2

I want to enable the usage of @SuppressWarnings in sonar like described in this answer: How to disable a particular checkstyle rule for a particular line of code?

But the only part where I can configure checkstyle specific behaviour in sonar is under Project Configuration -> Settings -> Java -> Checkstyle

When I add this configuration to the Filters Textbox:

<module name="TreeWalker">
  <module name="SuppressWarningsHolder" />
</module>
<module name="SuppressWarningsFilter" />

Then it doesn't accept the @SuppressWarnings. Is there a way how to configure this in sonar?

Community
  • 1
  • 1
haschibaschi
  • 2,734
  • 23
  • 31

2 Answers2

1

This is not possible for the moment: a ticket has been created to support it: http://jira.codehaus.org/browse/SONARCHKST-22

benzonico
  • 10,635
  • 5
  • 42
  • 50
1

For the rule checkstyle:com.puppycrawl.tools.checkstyle.checks.naming.AbstractClassNameCheck use:

@SuppressWarnings("checkstyle:abstractclassname")

See also SONARCHKST-22 SupportSuppressWarningsFilter as mentioned in benzonico's answer. This was implemented in the SonarQube Checkstyle plugin version 2.3.

Arend v. Reinersdorff
  • 4,110
  • 2
  • 36
  • 40