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

When using shellcheck --format=json1, csgrep output is missing position information #138

Closed
jamacku opened this issue Aug 21, 2023 · 3 comments · Fixed by #139
Closed

When using shellcheck --format=json1, csgrep output is missing position information #138

jamacku opened this issue Aug 21, 2023 · 3 comments · Fixed by #139
Assignees

Comments

@jamacku
Copy link
Member

jamacku commented Aug 21, 2023

How to reproduce

shellcheck --format=gcc script.sh | csgrep
Error: SHELLCHECK_WARNING:
innocent-script.sh:6:1: warning[SC2034]: UNUSED_VAR appears unused. Verify use (or export if used externally).

shellcheck --format=json1 script.sh | csgrep
Error: SHELLCHECK_WARNING:
innocent-script.sh:6: warning[SC2034]: UNUSED_VAR appears unused. Verify use (or export if used externally).

Please notice the missing 1 in the second output:

- innocent-script.sh:6:1: warning[SC2034]: UNUSED_VAR appears unused. Verify use (or export if used externally).
+ innocent-script.sh:6: warning[SC2034]: UNUSED_VAR appears unused. Verify use (or export if used externally).
jamacku added a commit to jamacku/differential-shellcheck that referenced this issue Aug 21, 2023
When using --format=json1, the csgrep output is missing defect position.

Reported in: csutils/csdiff#138

Once fixed, this commit should be reverted
jamacku added a commit to jamacku/differential-shellcheck that referenced this issue Aug 21, 2023
When using --format=json1, the csgrep output is missing defect position.

Reported in: csutils/csdiff#138

Once fixed, this commit should be reverted
@kdudka
Copy link
Member

kdudka commented Aug 21, 2023

@jamacku Could you please paste the output of shellcheck --format=json1 script.sh?

@jamacku
Copy link
Member Author

jamacku commented Aug 21, 2023

{
  "comments": [
    {
      "file": "innocent-script.sh",
      "line": 6,
      "endLine": 6,
      "column": 1,
      "endColumn": 11,
      "level": "warning",
      "code": 2034,
      "message": "UNUSED_VAR appears unused. Verify use (or export if used externally).",
      "fix": null
    }
  ]
}

@kdudka kdudka self-assigned this Aug 21, 2023
kdudka added a commit to kdudka/csdiff that referenced this issue Aug 21, 2023
The code originally read the information from `byte-column` field
while ShellCheck provided the information in the `column` field.

Fixes: csutils#138
Closes: csutils#139
@kdudka
Copy link
Member

kdudka commented Aug 21, 2023

@jamacku Thanks! I have opened pull request #139 to fix this.

@kdudka kdudka closed this as completed in d64f773 Aug 21, 2023
jamacku added a commit to redhat-plumbers-in-action/differential-shellcheck that referenced this issue Aug 23, 2023
When using --format=json1, the csgrep output is missing defect position.

Reported in: csutils/csdiff#138

Once fixed, this commit should be reverted
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants