#852 - Capture error codes for luacheck

This commit is contained in:
w0rp 2017-11-19 00:02:35 +00:00
parent 41cb174f3a
commit 40e26f0bc2
2 changed files with 12 additions and 5 deletions

View File

@ -35,8 +35,9 @@ function! ale_linters#lua#luacheck#Handle(buffer, lines) abort
call add(l:output, {
\ 'lnum': l:match[1] + 0,
\ 'col': l:match[2] + 0,
\ 'text': l:match[3] . l:match[4] . ': ' . l:match[5],
\ 'type': l:match[3],
\ 'code': l:match[3] . l:match[4],
\ 'text': l:match[5],
\})
endfor

View File

@ -1,6 +1,8 @@
Before:
Save g:ale_warn_about_trailing_whitespace
let g:ale_warn_about_trailing_whitespace = 1
runtime ale_linters/lua/luacheck.vim
After:
@ -13,19 +15,22 @@ Execute(The luacheck handler should parse lines correctly):
\ {
\ 'lnum': 1,
\ 'col': 8,
\ 'text': 'W612: line contains trailing whitespace',
\ 'text': 'line contains trailing whitespace',
\ 'code': 'W612',
\ 'type': 'W',
\ },
\ {
\ 'lnum': 3,
\ 'col': 5,
\ 'text': 'W213: unused loop variable ''k''',
\ 'text': 'unused loop variable ''k''',
\ 'code': 'W213',
\ 'type': 'W',
\ },
\ {
\ 'lnum': 3,
\ 'col': 19,
\ 'text': 'W113: accessing undefined variable ''x''',
\ 'text': 'accessing undefined variable ''x''',
\ 'code': 'W113',
\ 'type': 'W',
\ },
\ ],
@ -43,7 +48,8 @@ Execute(The luacheck handler should respect the warn_about_trailing_whitespace o
\ {
\ 'lnum': 5,
\ 'col': 43,
\ 'text': 'W212: unused argument ''g''',
\ 'text': 'unused argument ''g''',
\ 'code': 'W212',
\ 'type': 'W',
\ }
\ ],