UselessParentheses rule executed on empty ruleset
A source code analyzer
Brought to you by:
adangel,
juansotuyo
When creating a own ruleset which is empty, then the rule UselessParentheses is still executed. I tried to exclude it as described, but this does not work either. I tried with 5.0.5 and 5.1.1 - it's the same with both versions.
I really like to remove this rule.
Please see my ruleset. It contains only a description and a exclude-pattern for test classes. Hopefully you can reproduce it.
I can't reproduce your issue.
Are you sure you are only activating your empty ruleset and not accidentally the basic or the unnecessary rulesets in addition?
Are you using pmd from commandline or via a different integration (e.g. maven)?
The UselessParentheses rule is included in both java-basic and java-unnecessary.
If you don't want to have this rule, but still use basic, you'll need to exclude it. See http://pmd.sourceforge.net/pmd-5.1.1/howtomakearuleset.html "Excluding rules from a ruleset".
I'm using Gradle 1.10. I'm pretty sure that the ruleset is taken, because I stripped it down to nothing and it's still reporting UselessParentheses. I didn't know that the rule is included in two rulesets. I will investigate further tomorrow.
This https://github.com/gradle/gradle/blob/master/subprojects/code-quality/src/main/groovy/org/gradle/api/plugins/quality/PmdPlugin.groovy looks to me, as if the gradle-plugin automatically adds "basic" (or "java-basic") as the default ruleset.
So, you'll need to configure two properties for the gradle pmd plugin, to only execute your custom ruleset:
This was the missing hint. I could solve it. Thank you for the great support. Good work.