api / org.gradle.api.plugins.quality / CheckstyleExtension

CheckstyleExtension

open class CheckstyleExtension : CodeQualityExtension

Configuration options for the Checkstyle plugin.

See Also
CheckstylePlugin

Constructors

<init>

CheckstyleExtension(project: Project)

Functions

getConfig

open fun getConfig(): TextResource

The Checkstyle configuration to use. Replaces the configFile property.

getConfigDir

open fun getConfigDir(): File

Path to other Checkstyle configuration files. By default, this path is $rootProject.projectDir/config/checkstyle

This path will be exposed as the variable config_loc in Checkstyle's configuration files.

getConfigDirectory

open fun getConfigDirectory(): DirectoryProperty

Gets the configuration directory.

getConfigFile

open fun getConfigFile(): File

The Checkstyle configuration file to use.

getConfigProperties

open fun getConfigProperties(): MutableMap<String, Any>

The properties available for use in the configuration file. These are substituted into the configuration file.

getMaxErrors

open fun getMaxErrors(): Int

The maximum number of errors that are tolerated before breaking the build or setting the failure property. Defaults to 0.

Example: maxErrors = 42

getMaxWarnings

open fun getMaxWarnings(): Int

The maximum number of warnings that are tolerated before breaking the build or setting the failure property. Defaults to Integer.MAX_VALUE.

Example: maxWarnings = 1000

isShowViolations

open fun isShowViolations(): Boolean

Whether rule violations are to be displayed on the console. Defaults to true. Example: showViolations = false

setConfig

open fun setConfig(config: TextResource): Unit

The Checkstyle configuration to use. Replaces the configFile property.

setConfigDir

open fun setConfigDir(configDir: File): Unit

Path to other Checkstyle configuration files. By default, this path is $projectDir/config/checkstyle

This path will be exposed as the variable config_loc in Checkstyle's configuration files.

setConfigFile

open fun setConfigFile(configFile: File): Unit

The Checkstyle configuration file to use.

setConfigProperties

open fun setConfigProperties(configProperties: MutableMap<String, Any>): Unit

The properties available for use in the configuration file. These are substituted into the configuration file.

setMaxErrors

open fun setMaxErrors(maxErrors: Int): Unit

Set the maximum number of errors that are tolerated before breaking the build.

setMaxWarnings

open fun setMaxWarnings(maxWarnings: Int): Unit

Set the maximum number of warnings that are tolerated before breaking the build.

setShowViolations

open fun setShowViolations(showViolations: Boolean): Unit

Whether rule violations are to be displayed on the console. Defaults to true. Example: showViolations = false

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 CheckstyleExtension.ext: ExtraPropertiesExtension

Retrieves the ext extension.

Extension Functions

ext

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

Configures the ext extension.