mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-10 06:21:53 +08:00
Python support poetry (#3834)
* Add poetry support to python linters and black fixer. * Update python.vim to detect poetry project. * Update ale.vim, add an option for poetry `g:ale_python_auto_poetry`. * Update ale-python.txt, add poetry support. * Add and update poetry related tests. Co-authored-by: unc0 <unc0@users.noreply.github.com>
This commit is contained in:
@@ -6,6 +6,7 @@ call ale#Set('python_bandit_options', '')
|
||||
call ale#Set('python_bandit_use_config', 1)
|
||||
call ale#Set('python_bandit_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('python_bandit_auto_pipenv', 0)
|
||||
call ale#Set('python_bandit_auto_poetry', 0)
|
||||
|
||||
function! ale_linters#python#bandit#GetExecutable(buffer) abort
|
||||
if (
|
||||
@@ -15,6 +16,13 @@ function! ale_linters#python#bandit#GetExecutable(buffer) abort
|
||||
return 'pipenv'
|
||||
endif
|
||||
|
||||
if (
|
||||
\ ale#Var(a:buffer, 'python_auto_poetry')
|
||||
\ || ale#Var(a:buffer, 'python_bandit_auto_poetry')
|
||||
\) && ale#python#PoetryPresent(a:buffer)
|
||||
return 'poetry'
|
||||
endif
|
||||
|
||||
return ale#python#FindExecutable(a:buffer, 'python_bandit', ['bandit'])
|
||||
endfunction
|
||||
|
||||
@@ -31,7 +39,7 @@ function! ale_linters#python#bandit#GetCommand(buffer) abort
|
||||
endif
|
||||
endif
|
||||
|
||||
let l:exec_args = l:executable =~? 'pipenv$'
|
||||
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
|
||||
\ ? ' run bandit'
|
||||
\ : ''
|
||||
|
||||
|
||||
Reference in New Issue
Block a user