mirror of https://github.com/dense-analysis/ale
#852 - Capture error codes for slim-lint
This commit is contained in:
parent
7123f7236b
commit
01b2971d04
|
@ -28,11 +28,20 @@ function! ale_linters#slim#slimlint#Handle(buffer, lines) abort
|
||||||
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)
|
||||||
call add(l:output, {
|
let l:item = {
|
||||||
\ 'lnum': l:match[1] + 0,
|
\ 'lnum': l:match[1] + 0,
|
||||||
\ 'type': l:match[2],
|
\ 'type': l:match[2],
|
||||||
\ 'text': l:match[3]
|
\ '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
|
endfor
|
||||||
|
|
||||||
return l:output
|
return l:output
|
||||||
|
|
|
@ -11,12 +11,14 @@ Execute(The slim handler should parse lines correctly):
|
||||||
\ [
|
\ [
|
||||||
\ {
|
\ {
|
||||||
\ 'lnum': 1,
|
\ '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',
|
\ 'type': 'W',
|
||||||
\ },
|
\ },
|
||||||
\ {
|
\ {
|
||||||
\ 'lnum': 2,
|
\ 'lnum': 2,
|
||||||
\ 'text': 'LineLength: Line is too long. [136/80]',
|
\ 'text': 'Line is too long. [136/80]',
|
||||||
|
\ 'code': 'LineLength',
|
||||||
\ 'type': 'W',
|
\ 'type': 'W',
|
||||||
\ },
|
\ },
|
||||||
\ {
|
\ {
|
||||||
|
|
Loading…
Reference in New Issue