actionlint icon indicating copy to clipboard operation
actionlint copied to clipboard

actionlint doesn't show the line the error is on in a workflow

Open toast-gear opened this issue 3 years ago • 6 comments

When you run actionlint in a workflow it is unable to indicate which line the error is on:

https://github.com/toast-gear/actionlint-test/pull/3/checks

image

toast-gear avatar Dec 10 '21 21:12 toast-gear

It's not possible to point the position within multi-line string (after |) because go-yaml removes leading indentations and there is no way to know the length of the indentations from parsed YAML node.

rhysd avatar Sep 16 '22 15:09 rhysd

Perhaps feedback can cover the full run segment instead of only run:?

jbergstroem avatar Sep 29 '22 23:09 jbergstroem

What does feedback mean?

Anyway, I don't think this can be implemented unless go-yaml provides length of the indentation in a YAML AST node. If someone can submit a PR to fix this issue, I would happily review it.

rhysd avatar Sep 30 '22 06:09 rhysd

What does feedback mean?

Sorry, explained myself poorly. Feedback as in the underline and "full segments" would be all content in the run directive.

Anyway, I don't think this can be implemented unless go-yaml provides length of the indentation in a YAML AST node.

I came to the same conclusion.

jbergstroem avatar Sep 30 '22 12:09 jbergstroem

So you mean we can get the position information from the parent node of the script string node, right? I think it would be hard.

  • go-yaml's Node API does not provide the end position of the node. It only provides the start position.
  • Even if we can know the end position of the parent node, we still need to parse its contents to get the indent of the child string node. I think it means we need to re-implement YAML parser partially. YAML has complex syntax so it would not be easy.

rhysd avatar Sep 30 '22 13:09 rhysd