Update Checkstyle for new tool support and improved configuration.
Review Request #11584 — Created April 8, 2021 and submitted — Latest diff uploaded
This updates
CheckstyleTool
to subclass the newerBaseTool
, and to
use the newer features it offers (dependencies, improved file extension
handling, centralized base command building, new comment options, and
Java tool mixin).Configuration for checkstyle has improved. It previously required a full
XML file body to be set, which was a lot to manage. Now, to simplify
things, we also allow a Checkstyle-bundled XML file to be specified
(google_checks.xml
orsun_checks.xml
). If provided, we'll use that
instead of assuming the content is an XML document body.They could also potentially drop a
.jar
file in the class path with
XML files, and reference that in theConfiguration XML
option.Parsing has improved, handling syntax errors with configurations or
source code and leaving a suitable comment. For other errors, we now
include column, severity, and error code information in the comment.Python 3 compatibility was also fixed.
make_tempfile()
was being
called with a Unicode string for the configuration contents, but
requires a byte string.
Unit tests pass on Python 2.7 and 3.x.