You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Run: checkstyle-6.6.jar -f xml -c /sun_checks.xml Foo.java
Exception is thrown and usage is printed, even though the results are produced. This breaks any tool that parses the resulting XML from standard output.
ACTUAL STDOUT:
<?xml version="1.0" encoding="UTF-8"?>
<checkstyle version="6.6">
<file name="/tmp/Foo.java">
<error line="0" severity="error" message="Missing package-info.java file." source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocPackageCheck"/>
<error line="1" severity="error" message="Missing a Javadoc comment." source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocTypeCheck"/>
</file>
</checkstyle>
usage: java com.puppycrawl.tools.checkstyle.Main [options] -c <config.xml>
file...
-c <arg> Sets the check configuration file to use.
-f <arg> Sets the output format. (plain|xml). Defaults to plain
-o <arg> Sets the output file. Defaults to stdout
-p <arg> Loads the properties file
-v Print product version and exit
ACTUAL STDERR:
Could not execute Checkstyle: Checkstyle ends with 2 errors.
com.puppycrawl.tools.checkstyle.api.CheckstyleException: Checkstyle ends with 2 errors.
at com.puppycrawl.tools.checkstyle.Main.processCommandLine(Main.java:160)
at com.puppycrawl.tools.checkstyle.Main.main(Main.java:59)
EXPECTED RESULT:
Just the XML with errors found is printed to stdout. No exception is thrown, as the case of having errors in source files is not exceptional.
No usage should printed, as the tool was invoked correctly.
NOTES:
This is a regression from CheckStyle 6.5.
This works correctly when the output is printed to XML file (specified in '-o').
The text was updated successfully, but these errors were encountered:
console output is mixture of Checkstyle validation output and some CLI response, it was in 6.5 and will be always. I understand that it might cause you inconvenience is wrapping, but console output is not reliable for strict structure output. We should be in illusion that we could rely on certain structure on console out put, it even good that right now we clearly show that.
If you need clear validation output and you rely on it result please use "-o" option, in that output will never be stacktraces and other unexpected crash messages and argument validation messages that are not related to java code validation.
Structure of console output is (each part is optional):
"cli ouput" is a usage or any messages from CLI about arguments validation, at event footer message about final status and nothing about java validation.
"checkstyle java validation output" - is output of java validation only, that is independent from a way it was executed (cli, from gui , from application as embedded system, from web serivice, .... )
STEPS TO REPRODUCE:
Exception is thrown and usage is printed, even though the results are produced. This breaks any tool that parses the resulting XML from standard output.
ACTUAL STDOUT:
ACTUAL STDERR:
EXPECTED RESULT:
Just the XML with errors found is printed to stdout. No exception is thrown, as the case of having errors in source files is not exceptional.
No usage should printed, as the tool was invoked correctly.
NOTES:
This is a regression from CheckStyle 6.5.
This works correctly when the output is printed to XML file (specified in '-o').
The text was updated successfully, but these errors were encountered: