Make shellcheck respect ale_warn_about_trailing_whitespace
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--lua-only) (push) Has been cancelled
CI / test_ale (--neovim-07-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled

This commit is contained in:
w0rp
2025-07-06 18:47:41 +01:00
parent 9e49019a26
commit edccdfa9ef
2 changed files with 77 additions and 5 deletions

View File

@@ -1,8 +1,8 @@
Before:
runtime ale_linters/shell/shellcheck.vim
Save g:ale_warn_about_trailing_whitespace
After:
call ale#linter#Reset()
Restore
Execute(The shellcheck handler should handle basic errors or warnings <0.7.0):
AssertEqual
@@ -150,3 +150,58 @@ Execute(The shellcheck handler should handle info and style >=0.7.0):
\ ]
\ }'
\ ])
Execute(shellcheck errors for trailing whitespace should show by default):
AssertEqual
\ [
\ {
\ 'lnum': 8,
\ 'col': 12,
\ 'code': 'SC1101',
\ 'end_lnum': 8,
\ 'type': 'E',
\ 'end_col': 11,
\ 'text': 'Delete trailing spaces after \ to break line (or use quotes for literal space).',
\ 'detail': 'Delete trailing spaces after \ to break line (or use quotes for literal space).' . "\n\nFor more information:\n https://www.shellcheck.net/wiki/" . 'SC1101',
\ },
\ ],
\ ale#handlers#shellcheck#Handle(bufnr(''), [0, 7, 0], [
\ '{
\ "comments": [
\ {
\ "file": "-",
\ "line": 8,
\ "endLine": 8,
\ "column": 12,
\ "endColumn": 12,
\ "level": "error",
\ "code":1101,
\ "message":"Delete trailing spaces after \\ to break line (or use quotes for literal space).",
\ "fix":null
\ }
\ ]
\ }',
\ ])
Execute(shellcheck errors for trailing whitepsace should be able to be silenced by ale_warn_about_trailing_whitespace):
let g:ale_warn_about_trailing_whitespace = 0
AssertEqual
\ [],
\ ale#handlers#shellcheck#Handle(bufnr(''), [0, 7, 0], [
\ '{
\ "comments": [
\ {
\ "file": "-",
\ "line": 8,
\ "endLine": 8,
\ "column": 12,
\ "endColumn": 12,
\ "level": "error",
\ "code":1101,
\ "message":"Delete trailing spaces after \\ to break line (or use quotes for literal space).",
\ "fix":null
\ }
\ ]
\ }',
\ ])