I'm using Gradle to configure and run PMD over my source code. My build gradle file contains the following configuration for the PMD plugin:
pmd {
ruleSets = [
'java-android',
'java-basic',
'java-braces',
...,
'java-controverial'
]
}
I've have explicity enabled all checks within my build.gradle file and wish to disable those I deem unnecessary as I encounter them. The first rule I wish to disable is the UnnecessaryConstructor
rule.
Can I disable this rule from within my build.gradle file, or must I define an xml rules file and disable the rule from within there?
You don't have to define the XML in a file, you can define it inline via the incubating ruleSetConfig property.
Here an example in Kotlin DSL: