# Class CodeNarcExtension

java.lang.Object
org.gradle.api.plugins.quality.CodeQualityExtension
org.gradle.api.plugins.quality.CodeNarcExtension

public abstract class CodeNarcExtension extends CodeQualityExtension
Configuration options for the CodeNarc plugin.

Since:
  1.0
See Also:
  - `CodeNarcPlugin`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `CodeNarcExtension(Project project)`
  Creates a new `CodeNarcExtension`.

- ## Method Summary

  Modifier and Type
  Method
  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)`
  The CodeNarc configuration to use.
  `void`
  `setConfigFile(File file)`
  The CodeNarc configuration file to use.
  `void`
  `setMaxPriority1Violations(int maxPriority1Violations)`
  The maximum number of priority 1 violations allowed before failing the build.
  `void`
  `setMaxPriority2Violations(int maxPriority2Violations)`
  The maximum number of priority 2 violations allowed before failing the build.
  `void`
  `setMaxPriority3Violations(int maxPriority3Violations)`
  The maximum number of priority 3 violations allowed before failing the build.
  `void`
  `setReportFormat(String reportFormat)`
  The format type of the CodeNarc report.

  ### Methods inherited from class CodeQualityExtension

  `getObjectFactory, getReportsDir, getReportsDirectory, getSourceSets, getToolVersion, isIgnoreFailures, setIgnoreFailures, setReportsDir, setSourceSets, setToolVersion`

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### CodeNarcExtension

    public CodeNarcExtension(Project project)
    Creates a new `CodeNarcExtension`.
    Since:
      2.2

- ## Method Details

  - ### getConfig

    public TextResource getConfig()
    The CodeNarc configuration to use. Replaces the `configFile` property.
    Since:
      2.2

  - ### setConfig

    public void setConfig(TextResource config)
    The CodeNarc configuration to use. Replaces the `configFile` property.
    Since:
      2.2

  - ### getConfigFile

    public File getConfigFile()
    The CodeNarc configuration file to use.
    Since:
      1.0

  - ### setConfigFile

    public void setConfigFile(File file)
    The CodeNarc configuration file to use.
    Since:
      1.0

  - ### getMaxPriority1Violations

    public int getMaxPriority1Violations()
    The maximum number of priority 1 violations allowed before failing the build.
    Since:
      1.7

  - ### setMaxPriority1Violations

    public void setMaxPriority1Violations(int maxPriority1Violations)
    The maximum number of priority 1 violations allowed before failing the build.
    Since:
      1.7

  - ### getMaxPriority2Violations

    public int getMaxPriority2Violations()
    The maximum number of priority 2 violations allowed before failing the build.
    Since:
      1.7

  - ### setMaxPriority2Violations

    public void setMaxPriority2Violations(int maxPriority2Violations)
    The maximum number of priority 2 violations allowed before failing the build.
    Since:
      1.7

  - ### getMaxPriority3Violations

    public int getMaxPriority3Violations()
    The maximum number of priority 3 violations allowed before failing the build.
    Since:
      1.7

  - ### setMaxPriority3Violations

    public void setMaxPriority3Violations(int maxPriority3Violations)
    The maximum number of priority 3 violations allowed before failing the build.
    Since:
      1.7

  - ### getReportFormat

    public String getReportFormat()
    The format type of the CodeNarc report. One of `html`, `xml`, `text`, `console`.
    Since:
      1.0

  - ### setReportFormat

    public void setReportFormat(String reportFormat)
    The format type of the CodeNarc report. One of `html`, `xml`, `text`, `console`.
    Since:
      1.0