What is the difference between failOnError and failOnViolation in checkstyle plugin?

Viewed 410

In our project we use checkstyle as static analyzer (as maven plugin, I mean maven-checkstyle-plugin). I am new to this tool, and there is one thing I want to find out - what is the difference between failOnError and failOnViolation?

1 Answers

I think the plugin documentation is pretty clear, but the minimum expectation is going to be:

  • Do you want a log of the errors before failing the build? Then use failOnViolation

Or

  • Do you want to fail the build immediately, without waiting for errors to be logged? Then use failsOnError

Of course, if you set logViolationsToConsole to false (or on the CLI as -Dcheckstyle.console=false), then both act almost identically and can cause some confusion.

Related