api / org.gradle.api.plugins.quality / Checkstyle

Checkstyle

@CacheableTask open class Checkstyle : SourceTask, VerificationTask, Reporting<CheckstyleReports>

Runs Checkstyle against some source files.

Constructors

<init>

Checkstyle()

Functions

getAntBuilder

open fun getAntBuilder(): IsolatedAntBuilder

getCheckstyleClasspath

open fun getCheckstyleClasspath(): FileCollection

The class path containing the Checkstyle library to be used.

getClasspath

open fun getClasspath(): FileCollection

The class path containing the compiled classes for the source files to be analyzed.

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.

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

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.

getIgnoreFailures

open fun getIgnoreFailures(): Boolean

Whether or not this task will ignore failures and continue running the build.

getMaxErrors

open fun getMaxErrors(): Int

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

getMaxWarnings

open fun getMaxWarnings(): Int

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

getObjectFactory

open fun getObjectFactory(): ObjectFactory

Injects and returns an instance of org.gradle.api.model.ObjectFactory.

getReports

fun getReports(): CheckstyleReports

The reports to be generated by this task.

getSource

open fun getSource(): FileTree

{@inheritDoc}

The sources for this task are relatively relocatable even though it produces output that includes absolute paths. This is a compromise made to ensure that results can be reused between different builds. The downside is that up-to-date results, or results loaded from cache can show different absolute paths than would be produced if the task was executed.

isIgnoreFailures

open fun isIgnoreFailures(): Boolean

Whether this task will ignore failures and continue running the build.

isShowViolations

open fun isShowViolations(): Boolean

Whether rule violations are to be displayed on the console.

reports

open fun reports(closure: Closure<Any>): CheckstyleReports
open fun reports(configureAction: Action<in CheckstyleReports>): CheckstyleReports

Configures the reports to be generated by this task. The contained reports can be configured by name and closures. Example:

 checkstyleTask { reports { html { destination "build/codenarc.html" } } } 

run

open fun run(): Unit

setCheckstyleClasspath

open fun setCheckstyleClasspath(checkstyleClasspath: FileCollection): Unit

The class path containing the Checkstyle library to be used.

setClasspath

open fun setClasspath(classpath: FileCollection): Unit

The class path containing the compiled classes for the source files to be analyzed.

setConfig

open fun setConfig(config: TextResource): Unit

The Checkstyle configuration to use. Replaces the configFile property.

setConfigDir

open fun setConfigDir(configDir: Provider<File>): Unit

Path to other Checkstyle configuration files.

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.

setIgnoreFailures

open fun setIgnoreFailures(ignoreFailures: Boolean): Unit

Whether this task will ignore failures and continue running the build.

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.

Inherited Functions

exclude

open fun exclude(vararg excludes: String): SourceTask
open fun exclude(excludes: MutableIterable<String>): SourceTask
open fun exclude(excludeSpec: Spec<FileTreeElement>): SourceTask
open fun exclude(excludeSpec: Closure<Any>): SourceTask

{@inheritDoc}

getExcludes

open fun getExcludes(): MutableSet<String>

{@inheritDoc}

getIncludes

open fun getIncludes(): MutableSet<String>

{@inheritDoc}

include

open fun include(vararg includes: String): SourceTask
open fun include(includes: MutableIterable<String>): SourceTask
open fun include(includeSpec: Spec<FileTreeElement>): SourceTask
open fun include(includeSpec: Closure<Any>): SourceTask

{@inheritDoc}

setExcludes

open fun setExcludes(excludes: MutableIterable<String>): SourceTask

{@inheritDoc}

setIncludes

open fun setIncludes(includes: MutableIterable<String>): SourceTask

{@inheritDoc}

setSource

open fun setSource(source: FileTree): Unit

Sets the source for this task.

open fun setSource(source: Any): Unit

Sets the source for this task. The given source object is evaluated as per org.gradle.api.Project#files(Object...).

source

open fun source(vararg sources: Any): SourceTask

Adds some source to this task. The given source objects will be evaluated as per org.gradle.api.Project#files(Object...).