Open jamacku opened 2 years ago
I tried to run shellcheck --format=json **/*.sh
and the output looked like this (the top-level "comments":
was not there):
[
{
"file": "tests/test-lib.sh",
"line": 1,
"endLine": 1,
"column": 1,
"endColumn": 1,
"level": "error",
"code": 2148,
"message": "Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.",
"fix": null
},
{
"file": "tests/cssort/sync-diff.sh",
"line": 2,
"endLine": 2,
"column": 8,
"endColumn": 14,
"level": "warning",
"code": 2155,
"message": "Declare and assign separately to avoid masking return values.",
"fix": null
},
{
"file": "tests/cssort/sync-diff.sh",
"line": 5,
"endLine": 5,
"column": 8,
"endColumn": 12,
"level": "info",
"code": 2086,
"message": "Double quote to prevent globbing and word splitting.",
"fix": {
"replacements": [
{
"line": 5,
"endLine": 5,
"precedence": 14,
"insertionPoint": "afterEnd",
"column": 8,
"replacement": "\"",
"endColumn": 8
},
{
"line": 5,
"endLine": 5,
"precedence": 14,
"insertionPoint": "beforeStart",
"column": 12,
"replacement": "\"",
"endColumn": 12
}
]
}
}
]
Hmm, have you tried json1
format, json
seems to be marked as legacy.
json1
works as expected. My bad.
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
.
ShellCheck can suggest a possible solution of the reported defect. Unfortunately, this data isn't available in
gcc
format. It would be nice ifcsdiff
could parse ShellCheck JSON format, which contains possible fix underfix
key.Example:
Having this kind of information would be very useful for:
Thanks for working on this project! :+1: