Merge pull request #299 from derekprior/dp-fix-rubocop-again

Fix Rubocop filename handling
This commit is contained in:
w0rp 2017-02-05 22:31:43 +00:00 committed by GitHub
commit 0a14bbe78d

View File

@ -6,7 +6,7 @@ function! ale_linters#ruby#rubocop#Handle(buffer, lines) abort
" "
" <path>/_:47:14: 83:29: C: Prefer single-quoted strings when you don't " <path>/_:47:14: 83:29: C: Prefer single-quoted strings when you don't
" need string interpolation or special symbols. " need string interpolation or special symbols.
let l:pattern = '\v_:(\d+):(\d+): (.): (.+)' let l:pattern = '\v:(\d+):(\d+): (.): (.+)'
let l:output = [] let l:output = []
for l:line in a:lines for l:line in a:lines
@ -34,6 +34,12 @@ function! ale_linters#ruby#rubocop#Handle(buffer, lines) abort
return l:output return l:output
endfunction endfunction
function! ale_linters#ruby#rubocop#GetCommand(_buffer) abort
return 'rubocop --format emacs --force-exclusion ' .
\ g:ale_ruby_rubocop_options .
\ ' --stdin ' . expand('%')
endfunction
" Set this option to change Rubocop options. " Set this option to change Rubocop options.
if !exists('g:ale_ruby_rubocop_options') if !exists('g:ale_ruby_rubocop_options')
" let g:ale_ruby_rubocop_options = '--lint' " let g:ale_ruby_rubocop_options = '--lint'
@ -43,8 +49,6 @@ endif
call ale#linter#Define('ruby', { call ale#linter#Define('ruby', {
\ 'name': 'rubocop', \ 'name': 'rubocop',
\ 'executable': 'rubocop', \ 'executable': 'rubocop',
\ 'command': 'rubocop --format emacs --force-exclusion --stdin ' \ 'command_callback': 'ale_linters#ruby#rubocop#GetCommand',
\ . g:ale_ruby_rubocop_options
\ . ' %s',
\ 'callback': 'ale_linters#ruby#rubocop#Handle', \ 'callback': 'ale_linters#ruby#rubocop#Handle',
\}) \})