Open szpak opened 4 years ago
As a CodeNarc user, I would like this behaviour as well. I currently achieve it with the following build script (Groovy DSL):
tasks.withType(CodeNarc) { codeNarcTask ->
reports {
text.enabled = true
html.enabled = true
}
codeNarcTask.finalizedBy(project.task("print${codeNarcTask.name.capitalize()}") {
onlyIf {
codeNarcTask.state.failure != null
}
doLast {
logger.warn("\n****************************** CODE NARC ******************************")
logger.warn(codeNarcTask.reports.text.destination.text.trim())
logger.warn("****************************** CODE NARC ******************************\n")
}
})
}
This issue has been automatically marked as stale because it has not had recent activity. Given the limited bandwidth of the team, it will be automatically closed if no further activity occurs. If you're interested in how we try to keep the backlog in a healthy state, please read our blog post on how we refine our backlog. If you feel this is something you could contribute, please have a look at our Contributor Guide. Thank you for your contribution.
It would be still useful to have it available out of the box.
Expected Behavior
When executed without violations CodeNarc plugin generates only file/html reports (if enabled) - no output from CodeNarc tasks. If violations are found then they are reported on console (to do not have to look into files, also on a CI server).
Current Behavior
User has to choose to display also (usually) meaningless output on the executions without violations to see (without reading the report) also violations they accidentally occur.
Context
Unnecessary cluttered console or harder to get information about errors. User should be able to decide to only use console output on errors.
Tested with Gradle 6.3.