summaryrefslogtreecommitdiff
path: root/ale_linters/java
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-11-18 18:29:12 +0000
committerw0rp <devw0rp@gmail.com>2017-11-18 18:29:12 +0000
commit7455e2e97d0244c420c344ee1c737c93379bca4f (patch)
tree8b13a304d48552c2e04bb8c742a48304cfe34c5b /ale_linters/java
parent49ccfb1a00e09f6757b6e597883c95a34d612771 (diff)
downloadale-7455e2e97d0244c420c344ee1c737c93379bca4f.zip
#852 - Capture error codes for checkstyle
Diffstat (limited to 'ale_linters/java')
-rw-r--r--ale_linters/java/checkstyle.vim26
1 files changed, 8 insertions, 18 deletions
diff --git a/ale_linters/java/checkstyle.vim b/ale_linters/java/checkstyle.vim
index d3d48842..8155170a 100644
--- a/ale_linters/java/checkstyle.vim
+++ b/ale_linters/java/checkstyle.vim
@@ -2,27 +2,17 @@
" Description: checkstyle for Java files
function! ale_linters#java#checkstyle#Handle(buffer, lines) abort
- let l:patterns = [
- \ '\v\[(WARN|ERROR)\] .*:(\d+):(\d+): (.*)',
- \ '\v\[(WARN|ERROR)\] .*:(\d+): (.*)',
- \]
+ let l:pattern = '\v\[(WARN|ERROR)\] [a-zA-Z]?:?[^:]+:(\d+):(\d+)?:? (.*) \[(.+)\]$'
let l:output = []
- for l:match in ale#util#GetMatches(a:lines, l:patterns)
- let l:args = {
+ for l:match in ale#util#GetMatches(a:lines, l:pattern)
+ call add(l:output, {
+ \ 'type': l:match[1] is? 'WARN' ? 'W' : 'E',
\ 'lnum': l:match[2] + 0,
- \ 'type': l:match[1] =~? 'WARN' ? 'W' : 'E'
- \ }
-
- let l:col = l:match[3] + 0
- if l:col > 0
- let l:args['col'] = l:col
- let l:args['text'] = l:match[4]
- else
- let l:args['text'] = l:match[3]
- endif
-
- call add(l:output, l:args)
+ \ 'col': l:match[3] + 0,
+ \ 'text': l:match[4],
+ \ 'code': l:match[5],
+ \})
endfor
return l:output