All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
2 " Author: w0rp <devw0rp@gmail.com>
3 " Description: Error handling for CSS linters.
5 function! ale#handlers#css#HandleCSSLintFormat(buffer, lines) abort
6 " Matches patterns line the following:
8 " something.css: line 2, col 1, Error - Expected RBRACE at line 2, col 1. (errors)
9 " something.css: line 2, col 5, Warning - Expected (inline | block | list-item | inline-block | table | inline-table | table-row-group | table-header-group | table-footer-group | table-row | table-column-group | table-column | table-cell | table-caption | grid | inline-grid | run-in | ruby | ruby-base | ruby-text | ruby-base-container | ruby-text-container | contents | none | -moz-box | -moz-inline-block | -moz-inline-box | -moz-inline-grid | -moz-inline-stack | -moz-inline-table | -moz-grid | -moz-grid-group | -moz-grid-line | -moz-groupbox | -moz-deck | -moz-popup | -moz-stack | -moz-marker | -webkit-box | -webkit-inline-box | -ms-flexbox | -ms-inline-flexbox | flex | -webkit-flex | inline-flex | -webkit-inline-flex) but found 'wat'. (known-properties)
11 " These errors can be very massive, so the type will be moved to the front
12 " so you can actually read the error type.
13 let l:pattern = '\v^.*: line (\d+), col (\d+), (Error|Warning) - (.+)$'
16 for l:match in ale#util#GetMatches(a:lines, l:pattern)
18 \ 'lnum': l:match[1] + 0,
19 \ 'col': l:match[2] + 0,
20 \ 'type': l:match[3] is# 'Warning' ? 'W' : 'E',
24 let l:code_match = matchlist(l:match[4], '\v(.+) \(([^(]+)\)$')
26 " Split up the error code and the text if we find one.
27 if !empty(l:code_match)
28 let l:item.text = l:code_match[1]
29 let l:item.code = l:code_match[2]
32 call add(l:output, l:item)
38 function! ale#handlers#css#HandleStyleLintFormat(buffer, lines) abort
39 let l:exception_pattern = '\v^Error:'
41 for l:line in a:lines[:10]
42 if len(matchlist(l:line, l:exception_pattern)) > 0
45 \ 'text': 'stylelint exception thrown (type :ALEDetail for more information)',
46 \ 'detail': join(a:lines, "\n"),
51 " Matches patterns line the following:
54 " 108:10 ✖ Unexpected leading zero number-leading-zero
55 " 116:20 ✖ Expected a trailing semicolon declaration-block-trailing-semicolon
56 let l:pattern = '\v^.* (\d+):(\d+) \s+(\S+)\s+ (.*[^ ])\s+([^ ]+)\s*$'
59 for l:match in ale#util#GetMatches(a:lines, l:pattern)
61 \ 'lnum': l:match[1] + 0,
62 \ 'col': l:match[2] + 0,
63 \ 'type': l:match[3] is# '✖' ? 'E' : 'W',