How to Suppress Warnings in Sonar for properties f

2019-08-11 07:19发布

Is it possible to Suppress Warnings in properties file? Warnings are generated by SonarQube Java Properties Plugin.

Warning key *jproperties:** is (for example jproperties:key-naming-convention)

I tried to add comment with

#@SuppressWarnings("jproperties:key-naming-convention")

Before offending line but it does not work.

I know I could do one of

  1. disable those rules in my quality profile
  2. suppress warning in Sonar Web UI

I do not want solution 1) because it will ignore rule for all files, not just for single place.

I do not like solution 2) because I have separate sonar project for each branch (master, develop, feature branches) and separate project for each developer (for ad-hoc analysis). I do not want to suppress warnings in webUI for each project separately, I prefer to suppress warnings once-in source code.

1条回答
贼婆χ
2楼-- · 2019-08-11 07:46

It is not possible and there's no plan to add such a feature. The only thing that you might want to do is to exclude this rule for this very specific file by setting exclusions: http://docs.sonarqube.org/display/SONAR/Narrowing+the+Focus#NarrowingtheFocus-IgnoreIssues (Ignore Issues on Multiple Criteria criterion)

查看更多
登录 后发表回答