Fix #555 - Handle csslint errors without groups
This commit is contained in:
parent
78a7df52c0
commit
4c5e97dd1c
@ -10,17 +10,20 @@ function! ale#handlers#css#HandleCSSLintFormat(buffer, lines) abort
|
||||
"
|
||||
" These errors can be very massive, so the type will be moved to the front
|
||||
" so you can actually read the error type.
|
||||
let l:pattern = '^.*: line \(\d\+\), col \(\d\+\), \(Error\|Warning\) - \(.\+\) (\([^)]\+\))$'
|
||||
let l:pattern = '\v^.*: line (\d+), col (\d+), (Error|Warning) - (.+)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
let l:text = l:match[4]
|
||||
let l:type = l:match[3]
|
||||
let l:errorGroup = l:match[5]
|
||||
|
||||
let l:group_match = matchlist(l:text, '\v^(.+) \((.+)\)$')
|
||||
|
||||
" Put the error group at the front, so we can see what kind of error
|
||||
" it is on small echo lines.
|
||||
let l:text = '(' . l:errorGroup . ') ' . l:text
|
||||
if !empty(l:group_match)
|
||||
let l:text = '(' . l:group_match[2] . ') ' . l:group_match[1]
|
||||
endif
|
||||
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
|
@ -11,12 +11,33 @@ Execute(HandleCSSLintFormat should handle CSS errors):
|
||||
\ 'lnum': 2,
|
||||
\ 'col': 5,
|
||||
\ 'type': 'W',
|
||||
\ 'text': "(known-properties) Expected ... but found 'wat'.",
|
||||
\ 'text': '(known-properties) Expected ... but found ''wat''.',
|
||||
\ },
|
||||
\ ],
|
||||
\ ale#handlers#css#HandleCSSLintFormat(42, [
|
||||
\ 'something.css: line 2, col 1, Error - Expected RBRACE at line 2, col 1. (errors)',
|
||||
\ "something.css: line 2, col 5, Warning - Expected ... but found 'wat'. (known-properties)",
|
||||
\ 'something.css: line 2, col 5, Warning - Expected ... but found ''wat''. (known-properties)',
|
||||
\ ])
|
||||
|
||||
Execute(HandleCSSLintFormat should handle CSS errors without groups):
|
||||
AssertEqual
|
||||
\ [
|
||||
\ {
|
||||
\ 'lnum': 7,
|
||||
\ 'col': 3,
|
||||
\ 'type': 'W',
|
||||
\ 'text': 'Unknown property ''fill''.',
|
||||
\ },
|
||||
\ {
|
||||
\ 'lnum': 8,
|
||||
\ 'col': 3,
|
||||
\ 'type': 'W',
|
||||
\ 'text': 'Unknown property ''fill-opacity''.',
|
||||
\ },
|
||||
\ ],
|
||||
\ ale#handlers#css#HandleCSSLintFormat(42, [
|
||||
\ 'something.css: line 7, col 3, Warning - Unknown property ''fill''.',
|
||||
\ 'something.css: line 8, col 3, Warning - Unknown property ''fill-opacity''.',
|
||||
\ ])
|
||||
|
||||
Execute (HandlePEP8Format should handle the correct lines of output):
|
||||
|
Loading…
Reference in New Issue
Block a user