diff options
author | w0rp <w0rp@users.noreply.github.com> | 2018-09-14 13:27:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-14 13:27:07 +0100 |
commit | 7f1c411b5e5ef978e7bf4d032e6bd1ddeabb20c5 (patch) | |
tree | 92fc306223bcc1dda9f1826dbce7119cae37c246 /autoload | |
parent | 43d7e8fde9aedb5dc3d76014a64de04fbdbaa276 (diff) | |
parent | b01470cbbcfb64ba2ca5b23016e6c9e8702fb0ce (diff) | |
download | ale-7f1c411b5e5ef978e7bf4d032e6bd1ddeabb20c5.zip |
Merge pull request #1850 from rrosenblum/ruby_linters
Update all Ruby linters to work consistently with bundler
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/ale/fixers/rubocop.vim | 10 | ||||
-rw-r--r-- | autoload/ale/handlers/rubocop.vim | 6 | ||||
-rw-r--r-- | autoload/ale/handlers/ruby.vim | 7 |
3 files changed, 12 insertions, 11 deletions
diff --git a/autoload/ale/fixers/rubocop.vim b/autoload/ale/fixers/rubocop.vim index 0a39ef62..a4613817 100644 --- a/autoload/ale/fixers/rubocop.vim +++ b/autoload/ale/fixers/rubocop.vim @@ -1,12 +1,12 @@ +call ale#Set('ruby_rubocop_options', '') +call ale#Set('ruby_rubocop_executable', 'rubocop') + function! ale#fixers#rubocop#GetCommand(buffer) abort - let l:executable = ale#handlers#rubocop#GetExecutable(a:buffer) - let l:exec_args = l:executable =~? 'bundle$' - \ ? ' exec rubocop' - \ : '' + let l:executable = ale#Var(a:buffer, 'ruby_rubocop_executable') let l:config = ale#path#FindNearestFile(a:buffer, '.rubocop.yml') let l:options = ale#Var(a:buffer, 'ruby_rubocop_options') - return ale#Escape(l:executable) . l:exec_args + return ale#handlers#ruby#EscapeExecutable(l:executable, 'rubocop') \ . (!empty(l:config) ? ' --config ' . ale#Escape(l:config) : '') \ . (!empty(l:options) ? ' ' . l:options : '') \ . ' --auto-correct %t' diff --git a/autoload/ale/handlers/rubocop.vim b/autoload/ale/handlers/rubocop.vim deleted file mode 100644 index f6367cf5..00000000 --- a/autoload/ale/handlers/rubocop.vim +++ /dev/null @@ -1,6 +0,0 @@ -call ale#Set('ruby_rubocop_options', '') -call ale#Set('ruby_rubocop_executable', 'rubocop') - -function! ale#handlers#rubocop#GetExecutable(buffer) abort - return ale#Var(a:buffer, 'ruby_rubocop_executable') -endfunction diff --git a/autoload/ale/handlers/ruby.vim b/autoload/ale/handlers/ruby.vim index 110fe156..c28b8b75 100644 --- a/autoload/ale/handlers/ruby.vim +++ b/autoload/ale/handlers/ruby.vim @@ -37,3 +37,10 @@ function! ale#handlers#ruby#HandleSyntaxErrors(buffer, lines) abort return s:HandleSyntaxError(a:buffer, a:lines) endfunction +function! ale#handlers#ruby#EscapeExecutable(executable, bundle_exec) abort + let l:exec_args = a:executable =~? 'bundle' + \ ? ' exec ' . a:bundle_exec + \ : '' + + return ale#Escape(a:executable) . l:exec_args +endfunction |