<bdo id='h74Ii'></bdo><ul id='h74Ii'></ul>

    <i id='h74Ii'><tr id='h74Ii'><dt id='h74Ii'><q id='h74Ii'><span id='h74Ii'><b id='h74Ii'><form id='h74Ii'><ins id='h74Ii'></ins><ul id='h74Ii'></ul><sub id='h74Ii'></sub></form><legend id='h74Ii'></legend><bdo id='h74Ii'><pre id='h74Ii'><center id='h74Ii'></center></pre></bdo></b><th id='h74Ii'></th></span></q></dt></tr></i><div id='h74Ii'><tfoot id='h74Ii'></tfoot><dl id='h74Ii'><fieldset id='h74Ii'></fieldset></dl></div>

    <tfoot id='h74Ii'></tfoot>
  1. <small id='h74Ii'></small><noframes id='h74Ii'>

    <legend id='h74Ii'><style id='h74Ii'><dir id='h74Ii'><q id='h74Ii'></q></dir></style></legend>
    1. 如何抑制“common-java"规则的警告

      How to SuppressWarnings for #39;common-java#39; rules(如何抑制“common-java规则的警告)

      1. <tfoot id='fGbi4'></tfoot>

        <legend id='fGbi4'><style id='fGbi4'><dir id='fGbi4'><q id='fGbi4'></q></dir></style></legend>
        <i id='fGbi4'><tr id='fGbi4'><dt id='fGbi4'><q id='fGbi4'><span id='fGbi4'><b id='fGbi4'><form id='fGbi4'><ins id='fGbi4'></ins><ul id='fGbi4'></ul><sub id='fGbi4'></sub></form><legend id='fGbi4'></legend><bdo id='fGbi4'><pre id='fGbi4'><center id='fGbi4'></center></pre></bdo></b><th id='fGbi4'></th></span></q></dt></tr></i><div id='fGbi4'><tfoot id='fGbi4'></tfoot><dl id='fGbi4'><fieldset id='fGbi4'></fieldset></dl></div>
        • <bdo id='fGbi4'></bdo><ul id='fGbi4'></ul>

          <small id='fGbi4'></small><noframes id='fGbi4'>

            <tbody id='fGbi4'></tbody>
                本文介绍了如何抑制“common-java"规则的警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我需要暂时忽略规则单元测试的分支覆盖率不足"(common-java:InsufficientBranchCoverage).

                I need to temporary ignore rule "Insufficient branch coverage by unit tests" (common-java:InsufficientBranchCoverage).

                阅读 http://docs.sonarqube.org/display/SONAR/Frequently+Asked+Questions 我看到 SuppressWarnings 应该适用于所有规则.

                Reading http://docs.sonarqube.org/display/SONAR/Frequently+Asked+Questions I see that SuppressWarnings should work for all rules.

                但任何组合

                @SuppressWarnings("common-java:InsufficientBranchCoverage")
                @SuppressWarnings("InsufficientBranchCoverage")
                @SuppressWarnings("java:InsufficientBranchCoverage")
                

                对我不起作用.

                我使用 Sonar 5.0,Sonar Java 插件 3.0.

                I use Sonar 5.0, Sonar Java plugin 3.0.

                此警告可能会从声纳 UI 中被抑制(删除).我看到了两种解决方案

                This warning may be supressed (removed) from sonar UI. I see two solutions

                • 为我的质量配置文件禁用单元测试的分支覆盖率不足"规则.缺点是整个项目都禁用了该规则,而不仅仅是单个类

                • disable the rule 'Insufficient branch coverage by unit tests' for my quality profile. The drawback is, that rule is disabled for whole project, not just for single class

                在深入浏览问题时将问题标记为已忽略.这只会忽略问题的单一出现.缺点是,需要在每个声纳项目中标记问题(我们有每个分支的项目).当我需要删除警告时,我必须在声纳 UI 中为每个项目再次执行此操作.

                mark issue as ignored when browsing issues drilldown. This ignores only single occurence of the issue. The drawback is, issue need to be marked in every sonar project (we have project-per-branch). When I need to remove warning, I must do this in sonar UI again, for each project.

                推荐答案

                很遗憾,这是不可能的.

                Unfortunately, it is not possible.

                InsufficientBranchCoverage 规则直接应用于文件级别,因此它不链接到文件中的任何特定行.要使用 @SuppressWarnings 删除与给定规则键相关的问题,该规则必须在类或方法级别应用(您可以在文档中阅读).

                The InsufficientBranchCoverage rule applies directly at File level and it is consequently not linked to any particular line in the file. To remove issues related to a given rule key using @SuppressWarnings, the rule has to apply at Class or Method level (as you can read in the documentation).

                请注意,为了保证分析结果的一致性,我们不能在文件级别禁用问题,因为它可能会以隐藏本来完全合法的问题而告终(例如 java 文件有多个类).

                Note that to guarantee consistency of the results of the analysis, we can not disable the issue at File level, as it may end by hiding issues which would have been perfectly legit (take for instance the situation of a java file having multiple classes).

                这篇关于如何抑制“common-java"规则的警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                Slf4j LoggerFactory.getLogger and sonarqube(Slf4j LoggerFactory.getLogger 和 sonarqube)
                Security - Array is stored directly(安全性 - 数组直接存储)
                SonarQube quot;Class Not Foundquot; during Main AST Scan(SonarQube“找不到类在主 AST 扫描期间)
                Integrate Spock#39;s test with Sonar(将 Spock 的测试与声纳集成)
                How do I make Hudson/Jenkins fail if Sonar thresholds are breached?(如果违反声纳阈值,我如何让 Hudson/Jenkins 失败?)
                automatically add curly brackets to all if/else/for/while etc. in a java code-base(自动将大括号添加到 java 代码库中的所有 if/else/for/while 等)
                  <i id='cIKfl'><tr id='cIKfl'><dt id='cIKfl'><q id='cIKfl'><span id='cIKfl'><b id='cIKfl'><form id='cIKfl'><ins id='cIKfl'></ins><ul id='cIKfl'></ul><sub id='cIKfl'></sub></form><legend id='cIKfl'></legend><bdo id='cIKfl'><pre id='cIKfl'><center id='cIKfl'></center></pre></bdo></b><th id='cIKfl'></th></span></q></dt></tr></i><div id='cIKfl'><tfoot id='cIKfl'></tfoot><dl id='cIKfl'><fieldset id='cIKfl'></fieldset></dl></div>

                  <tfoot id='cIKfl'></tfoot>
                1. <small id='cIKfl'></small><noframes id='cIKfl'>

                    <tbody id='cIKfl'></tbody>
                        <bdo id='cIKfl'></bdo><ul id='cIKfl'></ul>
                        • <legend id='cIKfl'><style id='cIKfl'><dir id='cIKfl'><q id='cIKfl'></q></dir></style></legend>