checkstyle のバージョン6.6 以降では、
解析したソースコードにエラーレベルの規約違反が見つかると、標準出力に
$ java -jar checkstyle-6.7-SNAPSHOT-all.jar -f xml -c /sun_checks.xml Test.java
<?xml version="1.0" encoding="UTF-8"?>
<checkstyle version="6.7-SNAPSHOT">
<file name="/home/rivanov/tmp/cs_tests/Test.java">
......
</file>
</checkstyle>
Checkstyle ends with 12 errors.
のように、最後の 1行にCheckstyle ends with XXX errors.
というメッセージを吐くようになった。
https://github.com/checkstyle/checkstyle/issues/1018#issuecomment-99271206
そのため、解析結果を XML形式で標準出力に出力し、パイプでつなぐなどして別のツールに渡している場合、この 1行のせいで XMLデータのパースに失敗する場合がある。
解決策としては、以下のように一旦 ファイルに出力し、
それを次のツールに渡してやるとよい。
Before
java -jar checkstyle-6.7-SNAPSHOT-all.jar -f xml -c /sun_checks.xml \
| bundle exec saddler report \
--require saddler/reporter/github \
--reporter Saddler::Reporter::Github::CommitReviewComment
After
java -jar checkstyle-6.7-SNAPSHOT-all.jar -f xml -c /sun_checks.xml -o result.xml
bundle exec saddler report \
--require saddler/reporter/github \
--reporter Saddler::Reporter::Github::CommitReviewComment \
< result.xml