Skip to content

Please add support for ShellCheck JSON format #75

Description

@jamacku

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! 👍

Activity

  1. self-assigned this
    on Aug 26, 2022
  2. kdudka commented on Sep 8, 2022

    @kdudka
  3. jamacku commented on Sep 8, 2022

    @jamacku
    MemberAuthor

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

  4. kdudka commented on Sep 8, 2022

    @kdudka
    Member

    json1 works as expected. My bad.

  5. self-assigned this
    on Sep 8, 2022
  6. kdudka commented on Sep 8, 2022

    @kdudka
    Member

    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.

  7. reopened this on Oct 3, 2022
  8. removed their assignment
    on Sep 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions