summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiguel Palhas <mpalhas@gmail.com>2017-08-10 14:52:54 +0100
committerw0rp <w0rp@users.noreply.github.com>2017-08-10 14:52:54 +0100
commit0c26e8945cc662fb41ad3b2a808516a4501d1e07 (patch)
treee2e52f9ed7cd789ad05ff51c97ec35a59f7a98af
parent9ae2df195865e1f5ce3b1dab8b43c89e59ad471e (diff)
downloadale-0c26e8945cc662fb41ad3b2a808516a4501d1e07.zip
Rubocop fixer now uses g:ale_ruby_rubocop_options (#841)
* Rubocop fixer now uses g:ale_ruby_rubocop_options * Adds spec
-rw-r--r--autoload/ale/fixers/rubocop.vim3
-rw-r--r--test/fixers/test_rubocop_fixer_callback.vader17
2 files changed, 17 insertions, 3 deletions
diff --git a/autoload/ale/fixers/rubocop.vim b/autoload/ale/fixers/rubocop.vim
index 88dc1c43..557b7594 100644
--- a/autoload/ale/fixers/rubocop.vim
+++ b/autoload/ale/fixers/rubocop.vim
@@ -7,7 +7,8 @@ function! ale#fixers#rubocop#GetCommand(buffer) abort
return ale#Escape(l:executable) . l:exec_args
\ . (!empty(l:config) ? ' --config ' . ale#Escape(l:config) : '')
- \ . ' --auto-correct %t'
+ \ . ' --auto-correct %t '
+ \ . ale#Var(a:buffer, 'ruby_rubocop_options')
endfunction
diff --git a/test/fixers/test_rubocop_fixer_callback.vader b/test/fixers/test_rubocop_fixer_callback.vader
index e3383537..e9a87395 100644
--- a/test/fixers/test_rubocop_fixer_callback.vader
+++ b/test/fixers/test_rubocop_fixer_callback.vader
@@ -21,7 +21,7 @@ Execute(The rubocop callback should return the correct default values):
\ {
\ 'read_temporary_file': 1,
\ 'command': ale#Escape(g:ale_ruby_rubocop_executable)
- \ . ' --auto-correct %t',
+ \ . ' --auto-correct %t ',
\ },
\ ale#fixers#rubocop#Fix(bufnr(''))
@@ -33,6 +33,19 @@ Execute(The rubocop callback should include configuration files):
\ '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',
+ \ . ' --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(''))