Update Rubocop for new tool support and improved parsing.

Review Request #11578 — Created April 6, 2021 and submitted

Information

ReviewBot
release-3.0.x

Reviewers

This updates RubocopTool to subclass the newer BaseTool, and to use
the newer features it offers (dependencies, improved file extension
handling, centralized base command building, and new comment options).

The parsing has been redone to use the Rubocop JSON output, which
constains details such as line/column ranges and error codes. It also
tells Rubocode to provide URLs to any relevant docs when reporting
errors, and forces it not to comment on filenames (which can fail
depending on the temp filename that's created).

If we're unable to parse the JSON payload, we split the lines and use
the first line as an error. This seems to be the most reliable option,
as subsequent lines can end up with stack traces or "successful" JSON
payloads.

Unit tests pass on Python 2.7 and 3.x.

Summary ID
Update Rubocop for new tool support and improved parsing.
This updates `RubocopTool` to subclass the newer `BaseTool`, and to use the newer features it offers (dependencies, improved file extension handling, centralized base command building, and new comment options). The parsing has been redone to use the Rubocop JSON output, which constains details such as line/column ranges and error codes. It also tells Rubocode to provide URLs to any relevant docs when reporting errors, and forces it not to comment on filenames (which can fail depending on the temp filename that's created). If we're unable to parse the JSON payload, we split the lines and use the first line as an error. This seems to be the most reliable option, as subsequent lines can end up with stack traces or "successful" JSON payloads.
06bffd02a4ccd3cde27bf14605825c3c985a847f
Description From Last Updated

pyflakes -> rubocop

daviddavid
david
  1. 
      
  2. bot/reviewbot/tools/rubocop.py (Diff revision 1)
     
     

    pyflakes -> rubocop

  3. 
      
chipx86
david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-3.0.x (cdd46e3)
Loading...