mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-06 12:44:23 +08:00
Merge pull request #1850 from rrosenblum/ruby_linters
Update all Ruby linters to work consistently with bundler
This commit is contained in:
@@ -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'
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user