summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--autoload/ale/handlers/css.vim9
-rw-r--r--test/handler/test_common_handlers.vader25
2 files changed, 29 insertions, 5 deletions
diff --git a/autoload/ale/handlers/css.vim b/autoload/ale/handlers/css.vim
index 37ee5eea..7c4d3d14 100644
--- a/autoload/ale/handlers/css.vim
+++ b/autoload/ale/handlers/css.vim
@@ -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,
diff --git a/test/handler/test_common_handlers.vader b/test/handler/test_common_handlers.vader
index a9fc9149..e945b2cc 100644
--- a/test/handler/test_common_handlers.vader
+++ b/test/handler/test_common_handlers.vader
@@ -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):