[英]Configure same PMD ruleset for eclipse-pmd as gradle PMD uses - Which ruleset is used for net.sourceforge.pmd:pmd-java
I have PMD checks in my build.gradle
like this: 我的
build.gradle
有PMD检查,如下所示:
apply plugin: "pmd"
dependencies {
pmd "net.sourceforge.pmd:pmd-java:5.5.+"
}
/*** PMD ***/
pmd {
ignoreFailures = true
}
tasks.withType(Pmd) {
excludes = ["**/gen/*"]
reports {
xml.enabled = true
html.enabled = true
}
}
Which ruleset is used here? 这里使用哪个规则集?
I would like to configure the same ruleset for the eclipse PMD plugin (Project Properties -> PMD - Add). 我想为Eclipse PMD插件配置相同的规则集(项目属性-> PMD-添加)。 Ideally eclipse project is configured by gradle to have the correct settings.
理想情况下,通过gradle将eclipse项目配置为具有正确的设置。
The default config for Gradle is using java-basic
( source ) Gradle的默认配置是使用
java-basic
( source )
However, this is a very conservative approach that takes little advantage of all PMD has to offer. 但是,这是一种非常保守的方法,几乎没有利用所有PMD所提供的优势。
My personal advice as a PMD maintainer is that you: 作为PMD维护者,我的个人建议是:
Both Gradle and the PMD Eclipse plugin can load rules from a ruleset on file, making it easy to keep both of them in sync at all times. Gradle和PMD Eclipse插件都可以从文件中的规则集中加载规则,从而使它们始终保持同步很容易。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.