使用 pom.xml 禁用声纳规则? [英] Disable Sonar rule using pom.xml?

查看:84
本文介绍了使用 pom.xml 禁用声纳规则?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Spring Boot 和 Spring Jpa 示例,并希望通过 Maven 主要使用 pom.xml 文件在 Sonar 规则下禁用.我无权访问或无法在 SonarQube 中禁用该规则,因为它是为组织级别配置的.

I am using Spring Boot and Spring Jpa example and looking to disabled below Sonar rule through Maven mainly using pom.xml file. I don't have access or can't go and disable that rule in SonarQube as it's configured for the Org level.

方法不能有太多参数(squid:S00107)

Methods should not have too many parameters (squid:S00107)

我已经浏览了很多次网络,但还没有找到任何有前途的解决方案.这就是我所看到的:配置声纳以从 Maven 中排除文件pom.xml 也是.

I already went through web many times and did not find any promising solutions yet. This is what I look at : Configure Sonar to exclude files from Maven pom.xml too.

推荐答案

似乎有一种方法可以做到,但可能不受支持,即

There seem to be a way of doing it but it may not be supported i.e.

<properties>
    <sonar.issue.ignore.multicriteria>e1</sonar.issue.ignore.multicriteria>
    <sonar.issue.ignore.multicriteria.e1.ruleKey>squid:S00107</sonar.issue.ignore.multicriteria.e1.ruleKey>
    <sonar.issue.ignore.multicriteria.e1.resourceKey>**/*.java</sonar.issue.ignore.multicriteria.e1.resourceKey>
</properties>

参考:https://community.sonarsource.com/t/documentation-about-ignore-issues-seems-to-be-wrong-or-outdated/3353

但他们确实声明:

我们建议用户使用 UI 进行配置,以达到最佳效果经验.考虑通过 sonar-project.properties 的配置为一个未记录的黑客,没有官方支持,可能会也可能不会起作用可靠,使用风险自负.

We recommend users to use the UI to configure this, for best experience. Consider the configuration via sonar-project.properties as an undocumented hack, not official supported that may or may not work reliably, use at your own risk.

这篇关于使用 pom.xml 禁用声纳规则?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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