dense-analysis / ale

Check syntax in Vim/Neovim asynchronously and fix files, with Language Server Protocol (LSP) support
BSD 2-Clause "Simplified" License
13.57k stars 1.44k forks source link

Actionlint: correctly parse error line when using shellcheck sublinter #4689

Closed pixelastic closed 10 months ago

pixelastic commented 11 months ago

actionlint is a linter for GitHub Actions workflows. It includes the shellcheck linter, for linting run: 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 as run: 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 correct shellcheck 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.