0

Normally in gradle I have codenarc setup with most rules turned on.

codenarc {
    ignoreFailures = true
    configFile = file 'config/codenarc/codenarc.groovy'
}

I was able to get violations down, in the main source set, to a very small number and I would like to set the max violations and allow codenarc to fail the build when violations are added to the project.

codenarc {
    configFile = file 'config/codenarc/codenarc.groovy'
    maxPriority1Violations = 0
    maxPriority2Violations = 2
    maxPriority3Violations = 1
}

My problem is codenarcTest has tons of violations. I tried setting codenarcTest to ignore failures with this:

condenarcTest {
    ignoreFailures = true
}

Gradle cannot configure the task in this way for some reason.

A problem occurred evaluating root project 'graph-dsl'.
> Could not find method condenarcTest() for arguments [build_9wxt0rbmoonofvrk71q96y4et$_run_closure5@6fb2b7b4] on root project 'graph-dsl' of type org.gradle.api.Project.

How can I setup codenarcTest to ignoreFailures and codenarcMain to not ignoreFailures?

John Mercier
  • 1,637
  • 3
  • 20
  • 44
  • Hi. Can you add more info about the versions of codenarc and gradle (and therefore the gradle codenarc plugin) you are using? Also, if it's a multiproject build, that could be the problem. In that case, the codenarcMain and codenarcTest tasks are added to the subprojects not the root. Thanks, Jenn – jstrater Sep 13 '17 at 12:02
  • I'm using the default codenarc that comes with gradle 4.0. It is a single project. Here is my [build.gradle](https://github.com/moaxcp/graph-dsl/blob/master/build.gradle) file. – John Mercier Sep 14 '17 at 12:47

0 Answers0