# CheckstyleExtension

API Documentation: | `CheckstyleExtension`

Configuration options for the Checkstyle plugin.

### Properties

Property | Description
`config` | The Checkstyle configuration to use. Replaces the `configFile` property.
`configDirectory` | Path to other Checkstyle configuration files. By default, this path is `$rootProject.projectDir/config/checkstyle`
`configFile` | The Checkstyle configuration file to use.
`configProperties` | The properties available for use in the configuration file. These are substituted into the configuration file.
`enableExternalDtdLoad` | Incubating Enable the ability to use custom DTD files in config and load them from some location on all checkstyle tasks in this project. Disabled by default due to security concerns. See Checkstyle documentation for more details.
`ignoreFailures` | Whether to allow the build to continue if there are warnings. Example: ignoreFailures = true
`maxErrors` | The maximum number of errors that are tolerated before breaking the build or setting the failure property. Defaults to `0`.
`maxWarnings` | The maximum number of warnings that are tolerated before breaking the build or setting the failure property. Defaults to `Integer.MAX_VALUE`.
`reportsDir` | Replaced The directory where reports will be generated.
`reportsDirectory` | Incubating The directory where reports will be generated.
`showViolations` | Whether rule violations are to be displayed on the console. Defaults to `true`. Example: showViolations = false
`sourceSets` | The source sets to be analyzed as part of the `check` and `build` tasks.
`toolVersion` | The version of the code quality tool to be used.

### Methods

No methods

### Script blocks

No script blocks

### Property details

#### `TextResource` `config`

The Checkstyle configuration to use. Replaces the `configFile` property.

Default with `checkstyle` plugin:
  ``${configDirectory}`/checkstyle.xml`

#### `DirectoryProperty` `configDirectory`

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.

Default with `checkstyle` plugin:
  ``${rootProject.projectDir}`/config/checkstyle`

#### `File` `configFile`

The Checkstyle configuration file to use.

Default with `checkstyle` plugin:
  ``${configDirectory}`/checkstyle.xml`

#### ``Map`<`String`, `Object`>` `configProperties`

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

Default with `checkstyle` plugin:
  `[:]`

#### ``Property`<`Boolean`>` `enableExternalDtdLoad`

Note: This property is incubating and may change in a future version of Gradle.

Enable the ability to use custom DTD files in config and load them from some location on all checkstyle tasks in this project. Disabled by default due to security concerns. See Checkstyle documentation for more details.

Default with `checkstyle` plugin:
  `false`

#### `boolean` `ignoreFailures`

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

Default:
  `false`

#### `int` `maxErrors`

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

Example: maxErrors = 42

Default with `checkstyle` plugin:
  `0`

#### `int` `maxWarnings`

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

Default with `checkstyle` plugin:
  `Integer.MAX_VALUE`

#### `File` `reportsDir`

Note: This property has been replaced by reportsDirectory.

The directory where reports will be generated.

Default with `checkstyle` plugin:
  ``${project.reporting.baseDirectory}`/checkstyle`

#### `DirectoryProperty` `reportsDirectory`

Note: This property is incubating and may change in a future version of Gradle.

The directory where reports will be generated.

Default with `checkstyle` plugin:
  ``${project.reporting.baseDirectory}`/checkstyle`

#### `boolean` `showViolations`

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

Default with `checkstyle` plugin:
  `true`

#### ``Collection`<`SourceSet`>` `sourceSets`

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

Default:
  `project.sourceSets`

#### `String` `toolVersion`

The version of the code quality tool to be used.

Default with `checkstyle` plugin:
  `8.12`