如何在声纳中抑制属性文件的警告? [英] How to Suppress Warnings in Sonar for properties file?

查看:81
本文介绍了如何在声纳中抑制属性文件的警告?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以抑制属性文件中的警告?警告由 SonarQube Java Properties Plugin 生成.>

警告键 *jproperties:** 是(例如 jproperties:key-naming-convention)

我尝试添加评论

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

在违规行之前,但它不起作用.

我知道我可以做其中之一

  1. 在我的质量配置文件中禁用这些规则
  2. 抑制声纳 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

  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.

解决方案

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)

这篇关于如何在声纳中抑制属性文件的警告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆