Ported from Sourceforge patch 122, the text below was copy-pasted from there:
I would like to stop the build if checkstyle reports an "error" but the build should not stop if a "warning" occurs.
The problem is, that if Checkstyle is not able to do a test for some reason (e.g. "Got an exception - java.lang.RuntimeException: Unable to get class information for COSVisitorException.") the build fails because an "error" is reported.
The attatched patch uses the severity assigned to the module TreeWalker (default: "error") for this messages instead of always "error".
There is suggested patch for TreeWarker: https://sourceforge.net/p/checkstyle/patches/_discuss/thread/b96f7579/95b4/attachment/TreeWalker.patch
and also additional patch which adds docs: