Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add endColumn to output variables #219

Closed
jbergstroem opened this issue Sep 28, 2022 · 2 comments
Closed

Add endColumn to output variables #219

jbergstroem opened this issue Sep 28, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@jbergstroem
Copy link
Contributor

Seeing how snippets uses a column start/end to draw the tildes, perhaps this could also be exposed as endColumn? This way, graphical interfaces integrating actionlint can achieve a similar notation as the cli output.

$ actionlint
.github/workflows/lint.yml:27:9: shellcheck reported issue in this script: SC2016:info:1:20: Expressions don't expand in single quotes, use double quotes for that [shellcheck]
   |
27 |         run: |
   |         ^~~~

Current version

$ actionlint -format '{{json .}}' | jq
[
  {
    "message": "shellcheck reported issue in this script: SC2016:info:1:20: Expressions don't expand in single quotes, use double quotes for that",
    "filepath": ".github/workflows/lint.yml",
    "line": 27,
    "column": 9,
    "kind": "shellcheck",
    "snippet": "        run: |\n        ^~~~"
  }
]

With suggested change

$ actionlint -format '{{json .}}' | jq
[
  {
    "message": "shellcheck reported issue in this script: SC2016:info:1:20: Expressions don't expand in single quotes, use double quotes for that",
    "filepath": ".github/workflows/lint.yml",
    "line": 27,
    "column": 9,
    "endColumn": 13, 
    "kind": "shellcheck",
    "snippet": "        run: |\n        ^~~~"
  }
]
@rhysd rhysd added the enhancement New feature or request label Sep 28, 2022
@rhysd rhysd closed this as completed in 57c7c7d Sep 29, 2022
@rhysd
Copy link
Owner

rhysd commented Sep 29, 2022

Now end_column is included in the JSON objects, which indicates the column at the end of ^~~~~:

> ./actionlint -format '{{json .}}' test.yaml | jq
[
  {
    "message": "property \"unknown_prop\" is not defined in object type {arch: string; debug: string; name: string; os: string; temp: string; tool_cache: string; workspace: string}",
    "filepath": "test.yaml",
    "line": 7,
    "column": 23,
    "kind": "expression",
    "snippet": "      - run: echo ${{ runner.unknown_prop }}\n                      ^~~~~~~~~~~~~~~~~~~",
    "end_column": 41
  }
]

Note that end_column is equal to column when ^~~ is not shown due to some reason (for example, the error range is empty)

@rhysd
Copy link
Owner

rhysd commented Sep 30, 2022

v1.6.20 included this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants