summaryrefslogtreecommitdiff
path: root/ale_linters
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2020-08-31 09:12:36 +0100
committerw0rp <devw0rp@gmail.com>2020-08-31 09:12:36 +0100
commitac2100d410378906d7d277561f50ae3305b6429e (patch)
tree63b0892541173721c1c1e732befa11bdd1458cc6 /ale_linters
parentcdaeca452e7fe24b117ac840b392fe4e89acda57 (diff)
downloadale-ac2100d410378906d7d277561f50ae3305b6429e.zip
Fix flake8 cd logic for invalid options
Diffstat (limited to 'ale_linters')
-rw-r--r--ale_linters/python/flake8.vim26
1 files changed, 11 insertions, 15 deletions
diff --git a/ale_linters/python/flake8.vim b/ale_linters/python/flake8.vim
index 85216ae8..fc4ab692 100644
--- a/ale_linters/python/flake8.vim
+++ b/ale_linters/python/flake8.vim
@@ -40,27 +40,23 @@ endfunction
function! ale_linters#python#flake8#GetCdString(buffer) abort
let l:change_directory = ale#Var(a:buffer, 'python_flake8_change_directory')
+ let l:cd_string = ''
- " map legacy options to new ones
- if l:change_directory is# 1
- let l:change_directory = 'file'
- elseif l:change_directory is# 0
- let l:change_directory = 'off'
- endif
+ if l:change_directory is# 'project'
+ let l:project_root = ale#python#FindProjectRootIni(a:buffer)
- if l:change_directory is# 'file'
- return ale#path#BufferCdString(a:buffer)
- elseif l:change_directory is# 'off'
- return ''
+ if !empty(l:project_root)
+ let l:cd_string = ale#path#CdString(l:project_root)
+ endif
endif
- let l:project_root = ale#python#FindProjectRootIni(a:buffer)
-
- if !empty(l:project_root)
- return ale#path#CdString(l:project_root)
+ if (l:change_directory is# 'project' && empty(l:cd_string))
+ \|| l:change_directory is# 1
+ \|| l:change_directory is# 'file'
+ let l:cd_string = ale#path#BufferCdString(a:buffer)
endif
- return ale#path#BufferCdString(a:buffer)
+ return l:cd_string
endfunction
function! ale_linters#python#flake8#GetCommand(buffer, version) abort