haschibaschi
haschibaschi

Reputation: 2792

Use @SuppressWarnings with the sonar checkstyle plugin

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?

Upvotes: 2

Views: 1645

Answers (2)

Arend von Reinersdorff
Arend von Reinersdorff

Reputation: 4233

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.

Upvotes: 1

benzonico
benzonico

Reputation: 10833

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

Upvotes: 1

Related Questions