summaryrefslogtreecommitdiff
path: root/ale_linters
diff options
context:
space:
mode:
authorw0rp <w0rp@users.noreply.github.com>2017-02-05 22:31:43 +0000
committerGitHub <noreply@github.com>2017-02-05 22:31:43 +0000
commit0a14bbe78d18bc79a3b3bfd7792fc4c827de1728 (patch)
treeb6a835031518db7da210b011a9bf46a2976c7098 /ale_linters
parent744d7d789f859b70ea5981377600678c0ff4f6c2 (diff)
parentf2fc7072b9c8a0d7233c3de5c03f4e916281661d (diff)
downloadale-0a14bbe78d18bc79a3b3bfd7792fc4c827de1728.zip
Merge pull request #299 from derekprior/dp-fix-rubocop-again
Fix Rubocop filename handling
Diffstat (limited to 'ale_linters')
-rw-r--r--ale_linters/ruby/rubocop.vim12
1 files changed, 8 insertions, 4 deletions
diff --git a/ale_linters/ruby/rubocop.vim b/ale_linters/ruby/rubocop.vim
index 69d26d33..006dfae2 100644
--- a/ale_linters/ruby/rubocop.vim
+++ b/ale_linters/ruby/rubocop.vim
@@ -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
" need string interpolation or special symbols.
- let l:pattern = '\v_:(\d+):(\d+): (.): (.+)'
+ let l:pattern = '\v:(\d+):(\d+): (.): (.+)'
let l:output = []
for l:line in a:lines
@@ -34,6 +34,12 @@ function! ale_linters#ruby#rubocop#Handle(buffer, lines) abort
return l:output
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.
if !exists('g:ale_ruby_rubocop_options')
" let g:ale_ruby_rubocop_options = '--lint'
@@ -43,8 +49,6 @@ endif
call ale#linter#Define('ruby', {
\ 'name': 'rubocop',
\ 'executable': 'rubocop',
-\ 'command': 'rubocop --format emacs --force-exclusion --stdin '
-\ . g:ale_ruby_rubocop_options
-\ . ' %s',
+\ 'command_callback': 'ale_linters#ruby#rubocop#GetCommand',
\ 'callback': 'ale_linters#ruby#rubocop#Handle',
\})