如何 enable/disable Eclipse 中来自 SonarLint 的任何规则

How to enable/disable any rule from SonarLint in Eclipse

我在 Eclipse 中安装了 SonarLint,并且有一个远程设置的 sonarQube 服务器,但是两者的规则不同。如何在我的 Eclipse 中配置与 SonarLint 上的 SonarQube 相同的规则?

您想使用连接模式,以便在您的 IDE 上应用与 SonarQube 实例上 运行 相同的规则集。 查看相关文档: http://www.sonarlint.org/eclipse/#Connected

我想我会把它留在这里供任何人看......

到 Disable/Re-Enable 中的规则 SonarLint/Eclipse。 -Window-首选项-SonarLint-规则配置。 -Select 您的语言(在我的例子中 Java)。 -Select更改规则的掉落或打开+符号以显示所有规则。

在您的 Java 代码中,您可以使用注释禁用单个方法的特定规则:

@java.lang.SuppressWarnings("java:S2699")