mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Updated Integration (markdown)
@@ -20,41 +20,73 @@ ShellCheck currently has three machine parseable output formats
|
|||||||
|
|
||||||
### JSON output
|
### JSON output
|
||||||
|
|
||||||
ShellCheck can output a simple JSON format consisting of a single array of objects (formatted for clarity):
|
ShellCheck can output a simple JSON format consisting of an object with a list of comments (formatted for clarity):
|
||||||
|
|
||||||
```
|
```
|
||||||
$ shellcheck -f json1 myscript myotherscript
|
$ shellcheck -f json1 myscript myotherscript
|
||||||
[
|
{
|
||||||
|
"comments": [
|
||||||
{
|
{
|
||||||
"file": "myotherscript",
|
"file": "myotherscript",
|
||||||
"line": 2,
|
"line": 2,
|
||||||
"column": 2,
|
"endLine": 2,
|
||||||
|
"column": 1,
|
||||||
|
"endColumn": 2,
|
||||||
"level": "error",
|
"level": "error",
|
||||||
"code": 1035,
|
"code": 1035,
|
||||||
"message": "You need a space after the [ and before the ]."
|
"message": "You need a space after the [ and before the ].",
|
||||||
|
"fix": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"file": "myscript",
|
"file": "myscript",
|
||||||
"line": 2,
|
"line": 2,
|
||||||
|
"endLine": 2,
|
||||||
"column": 6,
|
"column": 6,
|
||||||
|
"endColumn": 8,
|
||||||
"level": "warning",
|
"level": "warning",
|
||||||
"code": 2039,
|
"code": 2039,
|
||||||
"message": "In POSIX sh, echo flags are undefined."
|
"message": "In POSIX sh, echo flags are undefined.",
|
||||||
|
"fix": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"file": "myscript",
|
"file": "myscript",
|
||||||
"line": 2,
|
"line": 2,
|
||||||
|
"endLine": 2,
|
||||||
"column": 9,
|
"column": 9,
|
||||||
|
"endColumn": 11,
|
||||||
"level": "info",
|
"level": "info",
|
||||||
"code": 2086,
|
"code": 2086,
|
||||||
"message": "Double quote to prevent globbing and word splitting."
|
"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
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
In the `json1` format, `line` and `column` start at 1, and tabs count as 1.
|
In the `json1` format, `line` and `column` start at 1, and tabs count as 1.
|
||||||
|
|
||||||
The legacy format `json` is the same, but with a tab stop of 8.
|
The legacy format `json` consists of just the `comments` array, with a tab stop of 8.
|
||||||
|
|
||||||
|
|
||||||
### XML output
|
### XML output
|
||||||
|
Reference in New Issue
Block a user