Rubocop fixer now uses g:ale_ruby_rubocop_options (#841)
* Rubocop fixer now uses g:ale_ruby_rubocop_options * Adds spec
This commit is contained in:
parent
9ae2df1958
commit
0c26e8945c
@ -7,7 +7,8 @@ function! ale#fixers#rubocop#GetCommand(buffer) abort
|
|||||||
|
|
||||||
return ale#Escape(l:executable) . l:exec_args
|
return ale#Escape(l:executable) . l:exec_args
|
||||||
\ . (!empty(l:config) ? ' --config ' . ale#Escape(l:config) : '')
|
\ . (!empty(l:config) ? ' --config ' . ale#Escape(l:config) : '')
|
||||||
\ . ' --auto-correct %t'
|
\ . ' --auto-correct %t '
|
||||||
|
\ . ale#Var(a:buffer, 'ruby_rubocop_options')
|
||||||
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ Execute(The rubocop callback should return the correct default values):
|
|||||||
\ {
|
\ {
|
||||||
\ 'read_temporary_file': 1,
|
\ 'read_temporary_file': 1,
|
||||||
\ 'command': ale#Escape(g:ale_ruby_rubocop_executable)
|
\ 'command': ale#Escape(g:ale_ruby_rubocop_executable)
|
||||||
\ . ' --auto-correct %t',
|
\ . ' --auto-correct %t ',
|
||||||
\ },
|
\ },
|
||||||
\ ale#fixers#rubocop#Fix(bufnr(''))
|
\ ale#fixers#rubocop#Fix(bufnr(''))
|
||||||
|
|
||||||
@ -33,6 +33,19 @@ Execute(The rubocop callback should include configuration files):
|
|||||||
\ 'read_temporary_file': 1,
|
\ 'read_temporary_file': 1,
|
||||||
\ 'command': ale#Escape(g:ale_ruby_rubocop_executable)
|
\ 'command': ale#Escape(g:ale_ruby_rubocop_executable)
|
||||||
\ . ' --config ' . ale#Escape(g:dir . '/ruby_paths/with_config/.rubocop.yml')
|
\ . ' --config ' . ale#Escape(g:dir . '/ruby_paths/with_config/.rubocop.yml')
|
||||||
\ . ' --auto-correct %t',
|
\ . ' --auto-correct %t ',
|
||||||
|
\ },
|
||||||
|
\ ale#fixers#rubocop#Fix(bufnr(''))
|
||||||
|
|
||||||
|
Execute(The rubocop callback should include custom rubocop options):
|
||||||
|
let g:ale_ruby_rubocop_options = '--except Lint/Debugger'
|
||||||
|
call ale#test#SetFilename('ruby_paths/with_config/dummy.rb')
|
||||||
|
|
||||||
|
AssertEqual
|
||||||
|
\ {
|
||||||
|
\ 'read_temporary_file': 1,
|
||||||
|
\ 'command': ale#Escape(g:ale_ruby_rubocop_executable)
|
||||||
|
\ . ' --config ' . ale#Escape(g:dir . '/ruby_paths/with_config/.rubocop.yml')
|
||||||
|
\ . ' --auto-correct %t --except Lint/Debugger',
|
||||||
\ },
|
\ },
|
||||||
\ ale#fixers#rubocop#Fix(bufnr(''))
|
\ ale#fixers#rubocop#Fix(bufnr(''))
|
||||||
|
Loading…
Reference in New Issue
Block a user