From 5c56174f658181db7324af4730dbd61ccf003712 Mon Sep 17 00:00:00 2001 From: Nick LaMuro Date: Wed, 26 Oct 2016 23:11:24 -0500 Subject: [PATCH] Move extra_args to the end of the rubocop command For some rubocop executables, a `--file` or `--path` option might be necessary to target a specific file to run the parser. This currently would need to be the last argument in the string to be paired up with the `l:filename` when running the RuboCop command. Swapping these arguments should retain the previous functionality just fine, while allowing for the use-case described above. Note: It was chosen to have `l:extra_args` last in the list versus `a:current_args` since a `--file` option is more useful to be applied to every command instead of on demand via the `a:current_args`. --- plugin/rubocop.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin/rubocop.vim b/plugin/rubocop.vim index 2d98d4e..efdae65 100644 --- a/plugin/rubocop.vim +++ b/plugin/rubocop.vim @@ -42,9 +42,9 @@ function! s:RuboCop(current_args) let l:extra_args = g:vimrubocop_extra_args let l:filename = @% let l:rubocop_cmd = g:vimrubocop_rubocop_cmd - let l:rubocop_opts = ' '.a:current_args.' '.l:extra_args.' --format emacs' + let l:rubocop_opts = ' --format emacs '.a:current_args.' '.l:extra_args if g:vimrubocop_config != '' - let l:rubocop_opts = ' '.l:rubocop_opts.' --config '.g:vimrubocop_config + let l:rubocop_opts = ' '.g:vimrubocop_config.' --config '.l:rubocop_opts endif let l:rubocop_output = system(l:rubocop_cmd.l:rubocop_opts.' '.l:filename)