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

Please add support for ShellCheck JSON format #75

Open
jamacku opened this issue Aug 22, 2022 · 4 comments · Fixed by #83
Open

Please add support for ShellCheck JSON format #75

jamacku opened this issue Aug 22, 2022 · 4 comments · Fixed by #83

Comments

@jamacku
Copy link
Member

jamacku commented Aug 22, 2022

ShellCheck can suggest a possible solution of the reported defect. Unfortunately, this data isn't available in gcc format. It would be nice if csdiff could parse ShellCheck JSON format, which contains possible fix under fix key.

Example:

{
  "comments": [
    {
      "file": "myotherscript",
      "line": 2,
      "endLine": 2,
      "column": 1,
      "endColumn": 2,
      "level": "error",
      "code": 1035,
      "message": "You need a space after the [ and before the ].",
      "fix": null
    },
    {
      "file": "myscript",
      "line": 2,
      "endLine": 2,
      "column": 6,
      "endColumn": 8,
      "level": "warning",
      "code": 2039,
      "message": "In POSIX sh, echo flags are undefined.",
      "fix": null
    },
    {
      "file": "myscript",
      "line": 2,
      "endLine": 2,
      "column": 9,
      "endColumn": 11,
      "level": "info",
      "code": 2086,
      "message": "Double quote to prevent globbing and word splitting.",
      "fix": {
        "replacements": [
          {
            "line": 2,
            "endLine": 2,
            "precedence": 7,
            "insertionPoint": "afterEnd",
            "column": 9,
            "replacement": "\"",
            "endColumn": 9
          },
          {
            "line": 2,
            "endLine": 2,
            "precedence": 7,
            "insertionPoint": "beforeStart",
            "column": 11,
            "replacement": "\"",
            "endColumn": 11
          }
        ]
      }
    }
  ]
}

Having this kind of information would be very useful for:

Thanks for working on this project! 👍

@lzaoral lzaoral self-assigned this Aug 26, 2022
@kdudka

This comment was marked as resolved.

@jamacku
Copy link
Member Author

jamacku commented Sep 8, 2022

Hmm, have you tried json1 format, json seems to be marked as legacy.

@kdudka
Copy link
Member

kdudka commented Sep 8, 2022

json1 works as expected. My bad.

@kdudka kdudka self-assigned this Sep 8, 2022
kdudka added a commit to kdudka/csdiff that referenced this issue Sep 8, 2022
... which is produced by `shellcheck --format=json ...`

Fixes: csutils#75
@kdudka
Copy link
Member

kdudka commented Sep 8, 2022

I have submitted draft pull request #83 that implements the basic support of the JSON format produced by ShellCheck. We yet need to figure out how to represent the information in the fix key such that it works with all the output formats supported by csdiff.

@jamacku jamacku linked a pull request Sep 8, 2022 that will close this issue
kdudka added a commit to kdudka/csdiff that referenced this issue Sep 26, 2022
... which is produced by `shellcheck --format=json ...`

Fixes: csutils#75
kdudka added a commit to kdudka/csdiff that referenced this issue Sep 30, 2022
... which is produced by `shellcheck --format=json1 ...`

Fixes: csutils#75
Closes: csutils#83
kdudka added a commit to kdudka/csdiff that referenced this issue Sep 30, 2022
... which is produced by `shellcheck --format=json1 ...`

Related: csutils#75
Closes: csutils#83
@kdudka kdudka closed this as completed in #83 Oct 3, 2022
@kdudka kdudka reopened this Oct 3, 2022
@lzaoral lzaoral removed their assignment Sep 13, 2023
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.

3 participants