Class CodeNarc
java.lang.Object
org.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
org.gradle.api.internal.ConventionTask
org.gradle.api.tasks.SourceTask
org.gradle.api.plugins.quality.CodeNarc
- All Implemented Interfaces:
Comparable<Task>, org.gradle.api.internal.DynamicObjectAware, org.gradle.api.internal.IConventionAware, org.gradle.api.internal.TaskInternal, ExtensionAware, Reporting<CodeNarcReports>, Task, PatternFilterable, VerificationTask, org.gradle.util.Configurable<Task>
@CacheableTask
public class CodeNarc
extends SourceTask
implements VerificationTask, Reporting<CodeNarcReports>
Runs CodeNarc against some source files.
-
Nested Class Summary
Nested classes/interfaces inherited from interface Task
Task.Namer -
Field Summary
Fields inherited from class SourceTask
sourceFields inherited from interface Task
TASK_ACTION, TASK_DEPENDS_ON, TASK_DESCRIPTION, TASK_GROUP, TASK_NAME, TASK_OVERWRITE, TASK_TYPE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.gradle.api.internal.project.IsolatedAntBuilderThe class path containing the CodeNarc library to be used.The class path to be used by CodeNarc when compiling classes during analysis.The CodeNarc configuration to use.The CodeNarc configuration file to use.booleanWhether the build should break when the verifications performed by this task fail.intThe maximum number of priority 1 violations allowed before failing the build.intThe maximum number of priority 2 violations allowed before failing the build.intThe maximum number of priority 3 violations allowed before failing the build.Injects and returns an instance ofObjectFactory.The reports to be generated by this task.Returns the source for this task, after the include and exclude patterns have been applied.Configures the reports to be generated by this task.reports(Action<? super CodeNarcReports> configureAction) Configures the reports to be generated by this task.voidrun()voidsetCodenarcClasspath(FileCollection codenarcClasspath) The class path containing the CodeNarc library to be used.voidsetCompilationClasspath(FileCollection compilationClasspath) The class path to be used by CodeNarc when compiling classes during analysis.voidsetConfig(TextResource config) The CodeNarc configuration to use.voidsetConfigFile(File configFile) The CodeNarc configuration file to use.voidsetIgnoreFailures(boolean ignoreFailures) Whether the build should break when the verifications performed by this task fail.voidsetMaxPriority1Violations(int maxPriority1Violations) The maximum number of priority 1 violations allowed before failing the build.voidsetMaxPriority2Violations(int maxPriority2Violations) The maximum number of priority 2 violations allowed before failing the build.voidsetMaxPriority3Violations(int maxPriority3Violations) The maximum number of priority 3 violations allowed before failing the build.Methods inherited from class SourceTask
exclude, exclude, exclude, exclude, getExcludes, getIncludes, getPatternSetFactory, include, include, include, include, setExcludes, setIncludes, setSource, setSource, sourceMethods inherited from class org.gradle.api.internal.ConventionTask
conventionMapping, conventionMapping, getConventionMappingMethods inherited from class DefaultTask
newInputDirectory, newInputFile, newOutputDirectory, newOutputFileMethods inherited from class org.gradle.api.internal.AbstractTask
addValidator, appendParallelSafeAction, compareTo, configure, deleteAllActions, dependsOn, dependsOnTaskDidWork, doFirst, doFirst, doFirst, doLast, doLast, doLast, execute, finalizedBy, getActions, getAnt, getAsDynamicObject, getConvention, getDependsOn, getDescription, getDestroyables, getDidWork, getEnabled, getExecuter, getExtensions, getFinalizedBy, getGroup, getIdentityPath, getImpliesSubProjects, getInputs, getLocalState, getLogger, getLogging, getMustRunAfter, getName, getOnlyIf, getOutputs, getPath, getProject, getServices, getShouldRunAfter, getStandardOutputCapture, getState, getTaskActions, getTaskDependencies, getTemporaryDir, getTemporaryDirFactory, getValidators, hasProperty, injectIntoNewInstance, isEnabled, isHasCustomActions, leftShift, mustRunAfter, onlyIf, onlyIf, prependParallelSafeAction, property, setActions, setDependsOn, setDescription, setDidWork, setEnabled, setExecuter, setFinalizedBy, setGroup, setImpliesSubProjects, setMustRunAfter, setOnlyIf, setOnlyIf, setProperty, setShouldRunAfter, shouldRunAfter, toString
-
Constructor Details
-
CodeNarc
public CodeNarc()
-
-
Method Details
-
getConfigFile
-
getSource
Returns the source for this task, after the include and exclude patterns have been applied. Ignores source files which do not exist.- Overrides:
getSourcein classSourceTask- Returns:
- The source.
-
setConfigFile
The CodeNarc configuration file to use. -
getObjectFactory
Injects and returns an instance ofObjectFactory.- Since:
- 4.2
-
getAntBuilder
@Inject public org.gradle.api.internal.project.IsolatedAntBuilder getAntBuilder() -
run
public void run() -
reports
Configures the reports to be generated by this task.- Specified by:
reportsin interfaceReporting<CodeNarcReports>- Parameters:
closure- The configuration- Returns:
- The report container
-
reports
Configures the reports to be generated by this task.- Specified by:
reportsin interfaceReporting<CodeNarcReports>- Parameters:
configureAction- The configuration- Returns:
- The report container
-
getCodenarcClasspath
The class path containing the CodeNarc library to be used. -
setCodenarcClasspath
The class path containing the CodeNarc library to be used. -
getCompilationClasspath
The class path to be used by CodeNarc when compiling classes during analysis.- Since:
- 4.2
-
setCompilationClasspath
The class path to be used by CodeNarc when compiling classes during analysis.- Since:
- 4.2
-
getConfig
The CodeNarc configuration to use. Replaces theconfigFileproperty.- Since:
- 2.2
-
setConfig
The CodeNarc configuration to use. Replaces theconfigFileproperty.- Since:
- 2.2
-
getMaxPriority1Violations
The maximum number of priority 1 violations allowed before failing the build. -
setMaxPriority1Violations
public void setMaxPriority1Violations(int maxPriority1Violations) The maximum number of priority 1 violations allowed before failing the build. -
getMaxPriority2Violations
The maximum number of priority 2 violations allowed before failing the build. -
setMaxPriority2Violations
public void setMaxPriority2Violations(int maxPriority2Violations) The maximum number of priority 2 violations allowed before failing the build. -
getMaxPriority3Violations
The maximum number of priority 3 violations allowed before failing the build. -
setMaxPriority3Violations
public void setMaxPriority3Violations(int maxPriority3Violations) The maximum number of priority 3 violations allowed before failing the build. -
getReports
The reports to be generated by this task.- Specified by:
getReportsin interfaceReporting<CodeNarcReports>- Returns:
- The report container
-
getIgnoreFailures
public boolean getIgnoreFailures()Whether the build should break when the verifications performed by this task fail.- Specified by:
getIgnoreFailuresin interfaceVerificationTask- Returns:
- false, when the build should break on failure, true when the failures should be ignored.
-
setIgnoreFailures
public void setIgnoreFailures(boolean ignoreFailures) Whether the build should break when the verifications performed by this task fail.- Specified by:
setIgnoreFailuresin interfaceVerificationTask- Parameters:
ignoreFailures- false to break the build on failure, true to ignore the failures. The default is false.
-