问题描述
是否可以在属性文件中抑制警告?SonarQube Java Properties Plugin 生成警告.p>
警告键 *jproperties:** 是(例如 jproperties:key-naming-convention)
我尝试添加评论
#@SuppressWarnings("jproperties:key-naming-convention")
在犯线之前但它不起作用.
我知道我可以做一个
- 在我的质量配置文件中禁用这些规则
- 抑制 Sonar Web UI 中的警告
我不想要解决方案 1),因为它会忽略所有文件的规则,而不仅仅是单个位置.
我不喜欢解决方案 2),因为我为每个分支(主分支、开发分支、功能分支)设置了单独的声纳项目,并为每个开发人员设置了单独的项目(用于临时分析).我不想分别在每个项目的 webUI 中抑制警告,我更喜欢在源代码中抑制警告一次.
这是不可能的,也没有计划添加这样的功能.您可能想要做的唯一事情是通过设置排除项来排除此非常特定文件的规则:http://docs.sonarqube.org/display/SONAR/Narrowing+the+Focus#NarrowingtheFocus-IgnoreIssues(忽略多个标准的问题)
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
- disable those rules in my quality profile
- 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.
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)
这篇关于如何抑制声纳中属性文件的警告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!