Actionlint: correctly parse error line when using shellcheck sublinter #4689
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
actionlint
is a linter for GitHub Actions workflows. It includes theshellcheck
linter, for lintingrun:
commands inside of GA workflows.The current Ale implementation was getting confused when parsing the line such an error occurred; it used the line returned by
shellcheck
(most commonly line 1 asrun:
entries are usually one-liners), instead of the line of the parent.yml
file.This PR addresses that, by adding a branching path when parsing the linting results. If it is identified as a
shellcheck
linting issue, it will further parse the output to extract the correctshellcheck
error message and error code, but keep the parent.yml
line.This now correctly attributes the error to the line it appears. It sets the column to the beginning of the
run:
key, not to the exact column where the error appears in the value. This could probably be added with a bit of math, but I wanted to keep the PR simple for now.