Skip to content

Instantly share code, notes, and snippets.

@rwols
Last active July 9, 2021 17:55
Show Gist options
  • Save rwols/50380fb9b7e021d544ea48abc8213043 to your computer and use it in GitHub Desktop.
Save rwols/50380fb9b7e021d544ea48abc8213043 to your computer and use it in GitHub Desktop.
diagnostic-languageserver configuration for both flake8 and shellcheck
{
"clients": {
"diagnostic-ls": {
"enabled": true,
"command": [
"diagnostic-languageserver",
"--stdio"
],
"selector": "source.python | source.shell",
"initializationOptions": {
"linters": {
// REF: https://gist.github.com/frou/f8c0da53bfadf3eb939d0e6699b306e1
"flake8": {
"command": "flake8",
"debounce": 100,
"args": [
"--format",
"%(row)d,%(col)d,%(code).1s,%(code)s %(text)s",
"-"
],
"sourceName": "flake8",
"formatLines": 1,
"formatPattern": [
"(\\d+),(\\d+),()([A-Z]),(.*)",
{
"line": 1,
"column": 2,
// Match a zero-length group so everything can be classified as a Warning rather than Error
"security": 3,
"message": 5
}
],
"securities": {
"": "warning"
}
},
// REF: https://gist.github.com/rchl/1077151a7339b734c1678fc626b123a2
"shellcheck": {
"command": "shellcheck",
"debounce": 100,
"args": [
"--format=json",
"-"
],
"offsetLine": 0,
"offsetColumn": 0,
"sourceName": "shellcheck",
"formatLines": 1,
"parseJson": {
"line": "line",
"column": "column",
"endLine": "endLine",
"endColumn": "endColumn",
"security": "level",
"message": "\\${message} [\\${code}]",
},
"securities": {
"error": "error",
"warning": "warning",
"note": "info"
}
}
},
"filetypes": {
"python": [
"flake8"
],
"shellscript": "shellcheck"
},
},
},
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment