api / org.gradle.api.plugins.quality / CodeNarcExtension

CodeNarcExtension

open class CodeNarcExtension : CodeQualityExtension

Configuration options for the CodeNarc plugin.

See Also
CodeNarc

Constructors

<init>

CodeNarcExtension(project: Project)

Functions

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.

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.

getReportFormat

open fun getReportFormat(): String

The format type of the CodeNarc report. One of html, xml, text, console.

setConfig

open fun setConfig(config: TextResource): Unit

The CodeNarc configuration to use. Replaces the configFile property.

setConfigFile

open fun setConfigFile(file: File): Unit

The CodeNarc configuration file to use.

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.

setReportFormat

open fun setReportFormat(reportFormat: String): Unit

The format type of the CodeNarc report. One of html, xml, text, console.

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

Retrieves the ext extension.

Extension Functions

ext

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

Configures the ext extension.