api / org.gradle.api.plugins.quality / PmdExtension

PmdExtension

open class PmdExtension : CodeQualityExtension

Configuration options for the PMD plugin.

See Also
PmdPlugin

Constructors

<init>

PmdExtension(project: Project)

Functions

getRulePriority

open fun getRulePriority(): Int

The rule priority threshold; violations for rules with a lower priority will not be reported. Default value is 5, which means that all violations will be reported. This is equivalent to PMD's Ant task minimumPriority property. See the official documentation for the list of priorities. Example: rulePriority = 3

getRuleSetConfig

open fun getRuleSetConfig(): TextResource

The custom rule set to be used (if any). Replaces ruleSetFiles, except that it does not currently support multiple rule sets. See the official documentation for how to author a rule set. Example: ruleSetConfig = resources.text.fromFile("config/pmd/myRuleSet.xml")

getRuleSetFiles

open fun getRuleSetFiles(): FileCollection

The custom rule set files to be used. See the official documentation for how to author a rule set file. Example: ruleSetFiles = files("config/pmd/myRuleSet.xml")

getRuleSets

open fun getRuleSets(): MutableList<String>

The built-in rule sets to be used. See the official list of built-in rule sets. Example: ruleSets = ["basic", "braces"]

getTargetJdk

open fun getTargetJdk(): TargetJdk

The target jdk to use with pmd, 1.3, 1.4, 1.5, 1.6, 1.7 or jsp

isConsoleOutput

open fun isConsoleOutput(): Boolean

Whether or not to write PMD results to System.out.

ruleSetFiles

open fun ruleSetFiles(vararg ruleSetFiles: Any): Unit

Convenience method for adding rule set files. Example: ruleSetFiles "config/pmd/myRuleSet.xml"

ruleSets

open fun ruleSets(vararg ruleSets: String): Unit

Convenience method for adding rule sets. Example: ruleSets "basic", "braces"

setConsoleOutput

open fun setConsoleOutput(consoleOutput: Boolean): Unit

Whether or not to write PMD results to System.out.

setRulePriority

open fun setRulePriority(intValue: Int): Unit

Sets the rule priority threshold.

setRuleSetConfig

open fun setRuleSetConfig(ruleSetConfig: TextResource): Unit

The custom rule set to be used (if any). Replaces ruleSetFiles, except that it does not currently support multiple rule sets. See the official documentation for how to author a rule set. Example: ruleSetConfig = resources.text.fromFile("config/pmd/myRuleSet.xml")

setRuleSetFiles

open fun setRuleSetFiles(ruleSetFiles: FileCollection): Unit

The custom rule set files to be used. See the official documentation for how to author a rule set file. Example: ruleSetFiles = files("config/pmd/myRuleSet.xml")

setRuleSets

open fun setRuleSets(ruleSets: MutableList<String>): Unit

The built-in rule sets to be used. See the official list of built-in rule sets. Example: ruleSets = ["basic", "braces"]

setTargetJdk

open fun setTargetJdk(targetJdk: TargetJdk): Unit
open fun setTargetJdk(value: Any): Unit

Sets the target jdk used with pmd.

Inherited Functions

getReportsDir

open fun getReportsDir(): File

The directory where reports will be generated.

getSourceSets

open fun getSourceSets(): MutableCollection<SourceSet>

The source sets to be analyzed as part of the check and build tasks.

getToolVersion

open fun getToolVersion(): String

The version of the code quality tool to be used.

isIgnoreFailures

open fun isIgnoreFailures(): Boolean

Whether to allow the build to continue if there are warnings. Example: ignoreFailures = true

setIgnoreFailures

open fun setIgnoreFailures(ignoreFailures: Boolean): Unit

Whether to allow the build to continue if there are warnings. Example: ignoreFailures = true

setReportsDir

open fun setReportsDir(reportsDir: File): Unit

The directory where reports will be generated.

setSourceSets

open fun setSourceSets(sourceSets: MutableCollection<SourceSet>): Unit

The source sets to be analyzed as part of the check and build tasks.

setToolVersion

open fun setToolVersion(toolVersion: String): Unit

The version of the code quality tool to be used.

Extension Properties

ext

val PmdExtension.ext: ExtraPropertiesExtension

Retrieves the ext extension.

Extension Functions

ext

fun PmdExtension.ext(configure: ExtraPropertiesExtension.() -> Unit): Unit

Configures the ext extension.