From 7fe61cdf0e961ee459e19ce6cf9e65cdf1f4f30a Mon Sep 17 00:00:00 2001 From: Horacio Sanson Date: Wed, 6 Jan 2021 10:37:48 +0900 Subject: [PATCH 1/2] Fix 3498 - Change standardrb fixer to read from stdin. Seems standardrb fails to properly use the --config option when using temporary files but works fine when reading from stdin. This commit changes the fixer so it uses stdin instead of temporary files. --- autoload/ale/fixers/standardrb.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autoload/ale/fixers/standardrb.vim b/autoload/ale/fixers/standardrb.vim index 54330a37..acb310c6 100644 --- a/autoload/ale/fixers/standardrb.vim +++ b/autoload/ale/fixers/standardrb.vim @@ -12,12 +12,12 @@ function! ale#fixers#standardrb#GetCommand(buffer) abort return ale#ruby#EscapeExecutable(l:executable, 'standardrb') \ . (!empty(l:config) ? ' --config ' . ale#Escape(l:config) : '') \ . (!empty(l:options) ? ' ' . l:options : '') - \ . ' --fix --force-exclusion %t' + \ . ' --fix --force-exclusion --stdin %s' endfunction function! ale#fixers#standardrb#Fix(buffer) abort return { \ 'command': ale#fixers#standardrb#GetCommand(a:buffer), - \ 'read_temporary_file': 1, + \ 'process_with': 'ale#fixers#rubocop#PostProcess' \} endfunction From 27a22e716135776c7c3f4b758213f00bb952095b Mon Sep 17 00:00:00 2001 From: Horacio Sanson Date: Wed, 6 Jan 2021 11:07:41 +0900 Subject: [PATCH 2/2] Update tests --- test/fixers/test_standardrb_fixer_callback.vader | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/fixers/test_standardrb_fixer_callback.vader b/test/fixers/test_standardrb_fixer_callback.vader index 99234b79..d315651f 100644 --- a/test/fixers/test_standardrb_fixer_callback.vader +++ b/test/fixers/test_standardrb_fixer_callback.vader @@ -21,9 +21,9 @@ Execute(The standardrb callback should return the correct default values): AssertEqual \ { - \ 'read_temporary_file': 1, + \ 'process_with': 'ale#fixers#rubocop#PostProcess', \ 'command': ale#Escape(g:ale_ruby_standardrb_executable) - \ . ' --fix --force-exclusion %t', + \ . ' --fix --force-exclusion --stdin %s', \ }, \ ale#fixers#standardrb#Fix(bufnr('')) @@ -32,10 +32,10 @@ Execute(The standardrb callback should include configuration files): AssertEqual \ { - \ 'read_temporary_file': 1, + \ 'process_with': 'ale#fixers#rubocop#PostProcess', \ 'command': ale#Escape(g:ale_ruby_standardrb_executable) \ . ' --config ' . ale#Escape(ale#path#Simplify(g:dir . '/ruby_paths/with_config/.standard.yml')) - \ . ' --fix --force-exclusion %t', + \ . ' --fix --force-exclusion --stdin %s', \ }, \ ale#fixers#standardrb#Fix(bufnr('')) @@ -45,10 +45,10 @@ Execute(The standardrb callback should include custom rubocop options): AssertEqual \ { - \ 'read_temporary_file': 1, + \ 'process_with': 'ale#fixers#rubocop#PostProcess', \ 'command': ale#Escape(g:ale_ruby_standardrb_executable) \ . ' --config ' . ale#Escape(ale#path#Simplify(g:dir . '/ruby_paths/with_config/.standard.yml')) \ . ' --except Lint/Debugger' - \ . ' --fix --force-exclusion %t', + \ . ' --fix --force-exclusion --stdin %s', \ }, \ ale#fixers#standardrb#Fix(bufnr(''))