Package: org.gradle.api.plugins.quality

## [Java] Class CodeNarcExtension

- org.gradle.api.plugins.quality.CodeNarcExtension

- Configuration options for the CodeNarc plugin.

  See Also:
    CodeNarc

- - ### Constructor Summary

    Constructors
    Constructor and description
    `CodeNarcExtension (Project project)`

  - ### Methods Summary

    Methods
    Type | Name and description
    --- | ---
    `TextResource` | `getConfig()` The CodeNarc configuration to use.
    `File` | `getConfigFile()` The CodeNarc configuration file to use.
    `int` | `getMaxPriority1Violations()` The maximum number of priority 1 violations allowed before failing the build.
    `int` | `getMaxPriority2Violations()` The maximum number of priority 2 violations allowed before failing the build.
    `int` | `getMaxPriority3Violations()` The maximum number of priority 3 violations allowed before failing the build.
    `String` | `getReportFormat()` The format type of the CodeNarc report.
    `void` | `setConfig(TextResource config)`
    `void` | `setConfigFile(File file)` The CodeNarc configuration file to use.
    `void` | `setMaxPriority1Violations(int maxPriority1Violations)`
    `void` | `setMaxPriority2Violations(int maxPriority2Violations)`
    `void` | `setMaxPriority3Violations(int maxPriority3Violations)`
    `void` | `setReportFormat(String reportFormat)`

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class CodeQualityExtension` | `getIgnoreFailures, getReportsDir, getSourceSets, getToolVersion, isIgnoreFailures, setIgnoreFailures, setReportsDir, setSourceSets, setToolVersion`
    `class groovy.lang.GroovyObjectSupport` | `groovy.lang.GroovyObjectSupport#setProperty(java.lang.String, java.lang.Object), groovy.lang.GroovyObjectSupport#getProperty(java.lang.String), groovy.lang.GroovyObjectSupport#invokeMethod(java.lang.String, java.lang.Object), groovy.lang.GroovyObjectSupport#setMetaClass(groovy.lang.MetaClass), groovy.lang.GroovyObjectSupport#getMetaClass(), groovy.lang.GroovyObjectSupport#wait(long, int), groovy.lang.GroovyObjectSupport#wait(long), groovy.lang.GroovyObjectSupport#wait(), groovy.lang.GroovyObjectSupport#equals(java.lang.Object), groovy.lang.GroovyObjectSupport#toString(), groovy.lang.GroovyObjectSupport#hashCode(), groovy.lang.GroovyObjectSupport#getClass(), groovy.lang.GroovyObjectSupport#notify(), groovy.lang.GroovyObjectSupport#notifyAll()`

- - ### Constructor Detail

    - #### public CodeNarcExtension(Project project)

  - ### Method Detail

    - #### @Incubating public TextResource getConfig()

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

      Since:
        2.2

    - #### public File getConfigFile()

      The CodeNarc configuration file to use.

    - #### public int getMaxPriority1Violations()

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

    - #### public int getMaxPriority2Violations()

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

    - #### public int getMaxPriority3Violations()

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

    - #### public String getReportFormat()

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

    - #### public void setConfig(TextResource config)

    - #### public void setConfigFile(File file)

      The CodeNarc configuration file to use.

    - #### public void setMaxPriority1Violations(int maxPriority1Violations)

    - #### public void setMaxPriority2Violations(int maxPriority2Violations)

    - #### public void setMaxPriority3Violations(int maxPriority3Violations)

    - #### public void setReportFormat(String reportFormat)