#852 - Capture error codes for slim-lint

This commit is contained in:
w0rp 2017-11-19 01:08:20 +00:00
parent 7123f7236b
commit 01b2971d04
2 changed files with 15 additions and 4 deletions

View File

@ -28,11 +28,20 @@ function! ale_linters#slim#slimlint#Handle(buffer, lines) abort
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)
call add(l:output, {
let l:item = {
\ 'lnum': l:match[1] + 0,
\ 'type': l:match[2],
\ 'text': l:match[3]
\})
\}
let l:code_match = matchlist(l:item.text, '\v^([^:]+): (.+)$')
if !empty(l:code_match)
let l:item.code = l:code_match[1]
let l:item.text = l:code_match[2]
endif
call add(l:output, l:item)
endfor
return l:output

View File

@ -11,12 +11,14 @@ Execute(The slim handler should parse lines correctly):
\ [
\ {
\ 'lnum': 1,
\ 'text': 'RedundantDiv: `div` is redundant when class attribute shortcut is present',
\ 'text': '`div` is redundant when class attribute shortcut is present',
\ 'code': 'RedundantDiv',
\ 'type': 'W',
\ },
\ {
\ 'lnum': 2,
\ 'text': 'LineLength: Line is too long. [136/80]',
\ 'text': 'Line is too long. [136/80]',
\ 'code': 'LineLength',
\ 'type': 'W',
\ },
\ {