1
0
Fork 0
mirror of synced 2024-11-05 00:48:57 -05:00
ultimate-vim/sources_non_forked/ale/ale_linters/ruby/rubocop.vim

32 lines
1 KiB
VimL
Raw Normal View History

" Author: ynonp - https://github.com/ynonp, Eddie Lebow https://github.com/elebow
" Description: RuboCop, a code style analyzer for Ruby files
2018-09-24 20:40:17 -04:00
call ale#Set('ruby_rubocop_executable', 'rubocop')
call ale#Set('ruby_rubocop_options', '')
function! ale_linters#ruby#rubocop#GetCommand(buffer) abort
2018-09-24 20:40:17 -04:00
let l:executable = ale#Var(a:buffer, 'ruby_rubocop_executable')
2018-09-24 20:40:17 -04:00
return ale#handlers#ruby#EscapeExecutable(l:executable, 'rubocop')
\ . ' --format json --force-exclusion '
\ . ale#Var(a:buffer, 'ruby_rubocop_options')
\ . ' --stdin ' . ale#Escape(expand('#' . a:buffer . ':p'))
endfunction
function! ale_linters#ruby#rubocop#GetType(severity) abort
if a:severity is? 'convention'
\|| a:severity is? 'warning'
\|| a:severity is? 'refactor'
return 'W'
endif
return 'E'
endfunction
call ale#linter#Define('ruby', {
\ 'name': 'rubocop',
2019-03-08 06:04:56 -05:00
\ 'executable': {b -> ale#Var(b, 'ruby_rubocop_executable')},
\ 'command': function('ale_linters#ruby#rubocop#GetCommand'),
2018-12-17 06:28:27 -05:00
\ 'callback': 'ale#ruby#HandleRubocopOutput',
\})