Update shellcheck for new tool support and better parsing.

Review Request #11576 — Created April 5, 2021 and submitted

Information

ReviewBot
release-3.0.x

Reviewers

This updates ShellCheckTool to subclass the newer BaseTool, and to
use the newer features it offers (dependencies, improved file pattern
support, central command building, new loggers, and new comment
options).

The list of file types and shebangs supported have been extended, based
on shellcheck's advertised capabilities.

The handling of shellcheck results has been improved. We now request
JSON output, and use that to convey column, error code, and severity
information.

The payload also provides suggested fixes, in the form of "replacement"
ranges. These are used to modify the referenced line(s) of code and
patch them up to provide a possible replacement line of code. The new
tool support will provide the resulting replacements in the comment, if
we're able to successfully apply them without any issues. This is
future-proofed to back out of the attempt if we see anything we don't
expect from shellcheck.

If anything goes wrong with parsing files or handling settings, the
resulting error is left as a comment on the file.

Unit tests passed on Python 2.7 and 3.x.

Summary ID
Update shellcheck for new tool support and better parsing.
This updates `ShellCheckTool` to subclass the newer `BaseTool`, and to use the newer features it offers (dependencies, improved file pattern support, central command building, new loggers, and new comment options). The list of file types and shebangs supported have been extended, based on shellcheck's advertised capabilities. The handling of shellcheck results has been improved. We now request JSON output, and use that to convey column, error code, and severity information. The payload also provides suggested fixes, in the form of "replacement" ranges. These are used to modify the referenced line(s) of code and patch them up to provide a possible replacement line of code. The new tool support will provide the resulting replacements in the comment, if we're able to successfully apply them without any issues. This is future-proofed to back out of the attempt if we see anything we don't expect from shellcheck. If anything goes wrong with parsing files or handling settings, the resulting error is left as a comment on the file.
2264c4462c76230cebfb5dd94dd38a712fd8aa18
Description From Last Updated

Copy-pasteo: pyflakes -> shellcheck. Mind checking your other changes to make sure I didn't miss this in the things I've …

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

    Copy-pasteo: pyflakes -> shellcheck. Mind checking your other changes to make sure I didn't miss this in the things I've already reviewed?

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

Status: Closed (submitted)

Change Summary:

Pushed to release-3.0.x (20385c9)
Loading...