Update shellcheck for new tool support and better parsing.
Review Request #11576 — Created April 5, 2021 and submitted — Latest diff uploaded
This updates
ShellCheckTool
to subclass the newerBaseTool
, 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.