Fix: Failed to execute rubocop fixer on other machine (#3916)

This commit is contained in:
Yuto Ito 2021-09-23 18:46:16 +09:00 committed by GitHub
parent f8a4c78b5b
commit c9c89a1853
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 0 additions and 16 deletions

View File

@ -21,12 +21,10 @@ endfunction
function! ale#fixers#rubocop#GetCommand(buffer) abort function! ale#fixers#rubocop#GetCommand(buffer) abort
let l:executable = ale#Var(a:buffer, 'ruby_rubocop_executable') 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') let l:options = ale#Var(a:buffer, 'ruby_rubocop_options')
let l:auto_correct_all = ale#Var(a:buffer, 'ruby_rubocop_auto_correct_all') let l:auto_correct_all = ale#Var(a:buffer, 'ruby_rubocop_auto_correct_all')
return ale#ruby#EscapeExecutable(l:executable, 'rubocop') return ale#ruby#EscapeExecutable(l:executable, 'rubocop')
\ . (!empty(l:config) ? ' --config ' . ale#Escape(l:config) : '')
\ . (!empty(l:options) ? ' ' . l:options : '') \ . (!empty(l:options) ? ' ' . l:options : '')
\ . (l:auto_correct_all ? ' --auto-correct-all' : ' --auto-correct') \ . (l:auto_correct_all ? ' --auto-correct-all' : ' --auto-correct')
\ . ' --force-exclusion --stdin %s' \ . ' --force-exclusion --stdin %s'

View File

@ -24,18 +24,6 @@ Execute(The rubocop callback should return the correct default values):
\ }, \ },
\ ale#fixers#rubocop#Fix(bufnr('')) \ ale#fixers#rubocop#Fix(bufnr(''))
Execute(The rubocop callback should include configuration files):
call ale#test#SetFilename('../test-files/ruby/with_config/dummy.rb')
AssertEqual
\ {
\ 'process_with': 'ale#fixers#rubocop#PostProcess',
\ 'command': ale#Escape(g:ale_ruby_rubocop_executable)
\ . ' --config ' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/ruby/with_config/.rubocop.yml'))
\ . ' --auto-correct --force-exclusion --stdin %s',
\ },
\ ale#fixers#rubocop#Fix(bufnr(''))
Execute(The rubocop callback should include custom rubocop options): Execute(The rubocop callback should include custom rubocop options):
let g:ale_ruby_rubocop_options = '--except Lint/Debugger' let g:ale_ruby_rubocop_options = '--except Lint/Debugger'
call ale#test#SetFilename('../test-files/ruby/with_config/dummy.rb') call ale#test#SetFilename('../test-files/ruby/with_config/dummy.rb')
@ -44,7 +32,6 @@ Execute(The rubocop callback should include custom rubocop options):
\ { \ {
\ 'process_with': 'ale#fixers#rubocop#PostProcess', \ 'process_with': 'ale#fixers#rubocop#PostProcess',
\ 'command': ale#Escape(g:ale_ruby_rubocop_executable) \ 'command': ale#Escape(g:ale_ruby_rubocop_executable)
\ . ' --config ' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/ruby/with_config/.rubocop.yml'))
\ . ' --except Lint/Debugger' \ . ' --except Lint/Debugger'
\ . ' --auto-correct --force-exclusion --stdin %s', \ . ' --auto-correct --force-exclusion --stdin %s',
\ }, \ },
@ -58,7 +45,6 @@ Execute(The rubocop callback should use auto-correct-all option when set):
\ { \ {
\ 'process_with': 'ale#fixers#rubocop#PostProcess', \ 'process_with': 'ale#fixers#rubocop#PostProcess',
\ 'command': ale#Escape(g:ale_ruby_rubocop_executable) \ 'command': ale#Escape(g:ale_ruby_rubocop_executable)
\ . ' --config ' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/ruby/with_config/.rubocop.yml'))
\ . ' --auto-correct-all --force-exclusion --stdin %s' \ . ' --auto-correct-all --force-exclusion --stdin %s'
\ }, \ },
\ ale#fixers#rubocop#Fix(bufnr('')) \ ale#fixers#rubocop#Fix(bufnr(''))