api / org.gradle.api.plugins.quality / CodeNarc

CodeNarc

@CacheableTask open class CodeNarc : SourceTask, VerificationTask, Reporting<CodeNarcReports>

Runs CodeNarc against some source files.

Constructors

<init>

CodeNarc()

Functions

getAntBuilder

open fun getAntBuilder(): IsolatedAntBuilder

getCodenarcClasspath

open fun getCodenarcClasspath(): FileCollection

The class path containing the CodeNarc library to be used.

getCompilationClasspath

open fun getCompilationClasspath(): FileCollection

The class path to be used by CodeNarc when compiling classes during analysis.

getConfig

open fun getConfig(): TextResource

The CodeNarc configuration to use. Replaces the configFile property.

getConfigFile

open fun getConfigFile(): File

The CodeNarc configuration file to use.

getIgnoreFailures

open fun getIgnoreFailures(): Boolean

Whether the build should break when the verifications performed by this task fail.

getMaxPriority1Violations

open fun getMaxPriority1Violations(): Int

The maximum number of priority 1 violations allowed before failing the build.

getMaxPriority2Violations

open fun getMaxPriority2Violations(): Int

The maximum number of priority 2 violations allowed before failing the build.

getMaxPriority3Violations

open fun getMaxPriority3Violations(): Int

The maximum number of priority 3 violations allowed before failing the build.

getObjectFactory

open fun getObjectFactory(): ObjectFactory

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

getReports

open fun getReports(): CodeNarcReports

The reports to be generated by this task.

getSource

open fun getSource(): FileTree

{@inheritDoc}

reports

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

Configures the reports to be generated by this task.

run

open fun run(): Unit

setCodenarcClasspath

open fun setCodenarcClasspath(codenarcClasspath: FileCollection): Unit

The class path containing the CodeNarc library to be used.

setCompilationClasspath

open fun setCompilationClasspath(compilationClasspath: FileCollection): Unit

The class path to be used by CodeNarc when compiling classes during analysis.

setConfig

open fun setConfig(config: TextResource): Unit

The CodeNarc configuration to use. Replaces the configFile property.

setConfigFile

open fun setConfigFile(configFile: File): Unit

The CodeNarc configuration file to use.

setIgnoreFailures

open fun setIgnoreFailures(ignoreFailures: Boolean): Unit

Whether the build should break when the verifications performed by this task fail.

setMaxPriority1Violations

open fun setMaxPriority1Violations(maxPriority1Violations: Int): Unit

The maximum number of priority 1 violations allowed before failing the build.

setMaxPriority2Violations

open fun setMaxPriority2Violations(maxPriority2Violations: Int): Unit

The maximum number of priority 2 violations allowed before failing the build.

setMaxPriority3Violations

open fun setMaxPriority3Violations(maxPriority3Violations: Int): Unit

The maximum number of priority 3 violations allowed before failing the build.

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...).