Class CodeNarc

    • Constructor Detail

      • CodeNarc

        public CodeNarc()
    • Method Detail

      • getConfigFile

        @Internal
        public File getConfigFile()
        The CodeNarc configuration file to use.
      • getSource

        @PathSensitive(RELATIVE)
        public FileTree getSource()
        Returns the source for this task, after the include and exclude patterns have been applied. Ignores source files which do not exist.
        Overrides:
        getSource in class SourceTask
        Returns:
        The source.
      • setConfigFile

        public void setConfigFile​(File configFile)
        The CodeNarc configuration file to use.
      • getAntBuilder

        @Inject
        public org.gradle.api.internal.project.IsolatedAntBuilder getAntBuilder()
      • run

        public void run()
      • getCodenarcClasspath

        @Classpath
        public FileCollection getCodenarcClasspath()
        The class path containing the CodeNarc library to be used.
      • setCodenarcClasspath

        public void setCodenarcClasspath​(FileCollection codenarcClasspath)
        The class path containing the CodeNarc library to be used.
      • getCompilationClasspath

        @Incubating
        @Classpath
        public FileCollection getCompilationClasspath()
        The class path to be used by CodeNarc when compiling classes during analysis.
        Since:
        4.2
      • setCompilationClasspath

        @Incubating
        public void setCompilationClasspath​(FileCollection compilationClasspath)
        The class path to be used by CodeNarc when compiling classes during analysis.
        Since:
        4.2
      • getConfig

        @Incubating
        public TextResource getConfig()
        The CodeNarc configuration to use. Replaces the configFile property.
        Since:
        2.2
      • setConfig

        @Incubating
        public void setConfig​(TextResource config)
        The CodeNarc configuration to use. Replaces the configFile property.
        Since:
        2.2
      • getMaxPriority1Violations

        @Input
        public int 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

        @Input
        public int 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

        @Input
        public int 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.
      • getIgnoreFailures

        public boolean getIgnoreFailures()
        Whether the build should break when the verifications performed by this task fail.
        Specified by:
        getIgnoreFailures in interface VerificationTask
        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:
        setIgnoreFailures in interface VerificationTask
        Parameters:
        ignoreFailures - false to break the build on failure, true to ignore the failures. The default is false.