From 40e26f0bc2a00d25defe190bc277a0cf6ea71479 Mon Sep 17 00:00:00 2001 From: w0rp Date: Sun, 19 Nov 2017 00:02:35 +0000 Subject: #852 - Capture error codes for luacheck --- ale_linters/lua/luacheck.vim | 3 ++- test/handler/test_lua_handler.vader | 14 ++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/ale_linters/lua/luacheck.vim b/ale_linters/lua/luacheck.vim index 9f9ca4c4..725153c6 100644 --- a/ale_linters/lua/luacheck.vim +++ b/ale_linters/lua/luacheck.vim @@ -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 diff --git a/test/handler/test_lua_handler.vader b/test/handler/test_lua_handler.vader index 035dac24..7cebb017 100644 --- a/test/handler/test_lua_handler.vader +++ b/test/handler/test_lua_handler.vader @@ -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', \ } \ ], -- cgit v1.2.3