summaryrefslogtreecommitdiff
path: root/ale_linters/javascript
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-11-18 23:55:47 +0000
committerw0rp <devw0rp@gmail.com>2017-11-18 23:55:47 +0000
commit41cb174f3aeaa38e3d558a197a194c0161fa5b66 (patch)
treeb9a37ef1c08d4444924b4534dd9eea0c4b1f7afa /ale_linters/javascript
parentcefc5dc5b8fc7cec75222f3cd4d090c1bd48f796 (diff)
downloadale-41cb174f3aeaa38e3d558a197a194c0161fa5b66.zip
#852 - Capture error codes for jscs
Diffstat (limited to 'ale_linters/javascript')
-rw-r--r--ale_linters/javascript/jscs.vim14
1 files changed, 9 insertions, 5 deletions
diff --git a/ale_linters/javascript/jscs.vim b/ale_linters/javascript/jscs.vim
index b3f826cf..bcf3ee3a 100644
--- a/ale_linters/javascript/jscs.vim
+++ b/ale_linters/javascript/jscs.vim
@@ -35,19 +35,23 @@ function! ale_linters#javascript#jscs#Handle(buffer, lines) abort
"
" foobar.js: line 2, col 1, Expected indentation of 1 characters
"
- let l:pattern = '^.*:\s\+line \(\d\+\),\s\+col\s\+\(\d\+\),\s\+\(.*\)$'
+ let l:pattern = '\v^.*:\s+line (\d+),\s+col\s+(\d+),\s+(.*)$'
let l:output = []
- let l:m = ale#util#GetMatches(a:lines, [l:pattern])
-
- for l:match in l:m
- let l:text = l:match[3]
+ for l:match in ale#util#GetMatches(a:lines, l:pattern)
let l:obj = {
\ 'lnum': l:match[1] + 0,
\ 'col': l:match[2] + 0,
\ 'text': l:match[3]
\}
+ let l:code_match = matchlist(l:match[3], '\v([^ :]+): (.+)$')
+
+ if !empty(l:code_match)
+ let l:obj.code = l:code_match[1]
+ let l:obj.text = l:code_match[2]
+ endif
+
call add(l:output, l:obj)
endfor