Update Checkstyle for new tool support and improved configuration.

Review Request #11584 — Created April 8, 2021 and submitted

Information

ReviewBot
release-3.0.x

Reviewers

This updates CheckstyleTool to subclass the newer BaseTool, 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 or sun_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 the Configuration 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.

Summary ID
Update Checkstyle for new tool support and improved configuration.
This updates `CheckstyleTool` to subclass the newer `BaseTool`, 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` or `sun_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 the `Configuration 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.
ae6125768fb2d9a73ea1490ff289e771ee161e84
Description From Last Updated

Leftover debug output?

daviddavid

F401 'reviewbot.utils.process.is_exe_in_path' imported but unused

reviewbotreviewbot
Checks run (1 failed, 1 succeeded)
flake8 failed.
JSHint passed.

flake8

david
  1. 
      
  2. bot/reviewbot/tools/checkstyle.py (Diff revision 1)
     
     
    Show all issues

    Leftover debug output?

  3. 
      
chipx86
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-3.0.x (a24cc9a)