How to Suppress Warnings in Sonar for properties file?

久未见 提交于 2019-12-11 11:52: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:


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)



来源:https://stackoverflow.com/questions/34038386/how-to-suppress-warnings-in-sonar-for-properties-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!