From 0f822b063cb9553c9e00bc63d0184ba8577e6248 Mon Sep 17 00:00:00 2001 From: w0rp Date: Sun, 4 Feb 2018 13:16:44 +0000 Subject: [PATCH] Fix #1330 - Find isort configs better by changing the working directory --- autoload/ale/fixers/isort.vim | 8 ++------ test/fixers/test_isort_fixer_callback.vader | 5 ++++- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/autoload/ale/fixers/isort.vim b/autoload/ale/fixers/isort.vim index 00d968f..b631822 100644 --- a/autoload/ale/fixers/isort.vim +++ b/autoload/ale/fixers/isort.vim @@ -15,12 +15,8 @@ function! ale#fixers#isort#Fix(buffer) abort return 0 endif - let l:config = ale#path#FindNearestFile(a:buffer, '.isort.cfg') - let l:config_options = !empty(l:config) - \ ? ' --settings-path ' . ale#Escape(l:config) - \ : '' - return { - \ 'command': ale#Escape(l:executable) . l:config_options . ' -', + \ 'command': ale#path#BufferCdString(a:buffer) + \ . ale#Escape(l:executable) . ' -', \} endfunction diff --git a/test/fixers/test_isort_fixer_callback.vader b/test/fixers/test_isort_fixer_callback.vader index 503057b..7c2b515 100644 --- a/test/fixers/test_isort_fixer_callback.vader +++ b/test/fixers/test_isort_fixer_callback.vader @@ -25,5 +25,8 @@ Execute(The isort callback should return the correct default values): silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_virtualenv/subdir/foo/bar.py') AssertEqual - \ {'command': ale#Escape(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/env/' . b:bin_dir . '/isort')) . ' -' }, + \ { + \ 'command': 'cd ' . ale#Escape(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/subdir/foo')) . ' && ' + \ . ale#Escape(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/env/' . b:bin_dir . '/isort')) . ' -', + \ }, \ ale#fixers#isort#Fix(bufnr(''))