#852 Capture error codes for shellcheck
This commit is contained in:
parent
b14377915b
commit
08f4f8f0fc
@ -71,7 +71,7 @@ function! ale_linters#sh#shellcheck#GetCommand(buffer, version_output) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#sh#shellcheck#Handle(buffer, lines) abort
|
function! ale_linters#sh#shellcheck#Handle(buffer, lines) abort
|
||||||
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):(\d+)?:? ([^:]+): (.+)$'
|
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):(\d+)?:? ([^:]+): (.+) \[([^\]]+)\]$'
|
||||||
let l:output = []
|
let l:output = []
|
||||||
|
|
||||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
@ -87,6 +87,7 @@ function! ale_linters#sh#shellcheck#Handle(buffer, lines) abort
|
|||||||
\ 'lnum': str2nr(l:match[2]),
|
\ 'lnum': str2nr(l:match[2]),
|
||||||
\ 'type': l:type,
|
\ 'type': l:type,
|
||||||
\ 'text': l:match[5],
|
\ 'text': l:match[5],
|
||||||
|
\ 'code': l:match[6],
|
||||||
\}
|
\}
|
||||||
|
|
||||||
if !empty(l:match[3])
|
if !empty(l:match[3])
|
||||||
|
@ -11,13 +11,15 @@ Execute(The shellcheck handler should handle basic errors or warnings):
|
|||||||
\ 'lnum': 2,
|
\ 'lnum': 2,
|
||||||
\ 'col': 1,
|
\ 'col': 1,
|
||||||
\ 'type': 'W',
|
\ 'type': 'W',
|
||||||
\ 'text': 'In POSIX sh, ''let'' is not supported. [SC2039]',
|
\ 'text': 'In POSIX sh, ''let'' is not supported.',
|
||||||
|
\ 'code': 'SC2039',
|
||||||
\ },
|
\ },
|
||||||
\ {
|
\ {
|
||||||
\ 'lnum': 2,
|
\ 'lnum': 2,
|
||||||
\ 'col': 3,
|
\ 'col': 3,
|
||||||
\ 'type': 'E',
|
\ 'type': 'E',
|
||||||
\ 'text': 'Don''t put spaces around the = in assignments. [SC1068]',
|
\ 'text': 'Don''t put spaces around the = in assignments.',
|
||||||
|
\ 'code': 'SC1068',
|
||||||
\ },
|
\ },
|
||||||
\ ],
|
\ ],
|
||||||
\ ale_linters#sh#shellcheck#Handle(bufnr(''), [
|
\ ale_linters#sh#shellcheck#Handle(bufnr(''), [
|
||||||
@ -32,7 +34,8 @@ Execute(The shellcheck handler should handle notes):
|
|||||||
\ 'lnum': 3,
|
\ 'lnum': 3,
|
||||||
\ 'col': 3,
|
\ 'col': 3,
|
||||||
\ 'type': 'I',
|
\ 'type': 'I',
|
||||||
\ 'text': 'Double quote to prevent globbing and word splitting. [SC2086]',
|
\ 'text': 'Double quote to prevent globbing and word splitting.',
|
||||||
|
\ 'code': 'SC2086',
|
||||||
\ },
|
\ },
|
||||||
\ ],
|
\ ],
|
||||||
\ ale_linters#sh#shellcheck#Handle(bufnr(''), [
|
\ ale_linters#sh#shellcheck#Handle(bufnr(''), [
|
||||||
|
Loading…
Reference in New Issue
Block a user