1
0
Fork 0
mirror of synced 2024-11-23 01:05:34 -05:00
ultimate-vim/sources_non_forked/ale/ale_linters/java/pmd.vim

37 lines
1 KiB
VimL
Raw Normal View History

2018-06-14 06:31:12 -04:00
" Author: Johannes Wienke <languitar@semipol.de>
" Description: PMD for Java files
function! ale_linters#java#pmd#Handle(buffer, lines) abort
2018-11-01 06:03:42 -04:00
let l:pattern = '"\(\d\+\)",".*","\(.\+\)","\(\d\+\)","\(\d\+\)","\(.\+\)","\(.\+\)","\(.\+\)"$'
2018-06-14 06:31:12 -04:00
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)
call add(l:output, {
\ 'type': 'W',
\ 'lnum': l:match[4] + 0,
\ 'text': l:match[5],
\ 'code': l:match[6] . ' - ' . l:match[7],
\})
endfor
return l:output
endfunction
function! ale_linters#java#pmd#GetCommand(buffer) abort
return 'pmd '
\ . ale#Var(a:buffer, 'java_pmd_options')
\ . ' -f csv'
\ . ' -d %t'
endfunction
if !exists('g:ale_java_pmd_options')
let g:ale_java_pmd_options = '-R category/java/bestpractices.xml'
endif
call ale#linter#Define('java', {
\ 'name': 'pmd',
\ 'executable': 'pmd',
2019-03-08 06:04:56 -05:00
\ 'command': function('ale_linters#java#pmd#GetCommand'),
2018-06-14 06:31:12 -04:00
\ 'callback': 'ale_linters#java#pmd#Handle',
\})