mirror of
https://github.com/dense-analysis/ale.git
synced 2026-02-07 02:11:05 +08:00
Improve support for python package manage: pipenv, poetry and uv (#4825)
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--neovim-06-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--neovim-06-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled
This commit is contained in:
committed by
GitHub
parent
954682108d
commit
a7ef1817b7
@@ -67,6 +67,16 @@ Execute(Poetry is detected when python_bandit_auto_poetry is set):
|
||||
\ . b:bandit_flags
|
||||
\ . ' -'
|
||||
|
||||
Execute(uv is used when python_bandit_auto_uv is set):
|
||||
let g:ale_python_bandit_auto_uv = 1
|
||||
call ale#test#SetFilename('../test-files/python/uv/whatever.py')
|
||||
|
||||
AssertLinter 'uv',
|
||||
\ ale#Escape('uv')
|
||||
\ . ' run bandit'
|
||||
\ . b:bandit_flags
|
||||
\ . ' -'
|
||||
|
||||
Execute(The bandit command callback should add .bandit by default):
|
||||
silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_bandit/namespace/foo/bar.py')
|
||||
|
||||
|
||||
@@ -217,3 +217,10 @@ Execute(poetry is detected when python_flake8_auto_poetry is set):
|
||||
AssertLinterCwd ale#python#FindProjectRootIni(bufnr(''))
|
||||
AssertLinter 'poetry',
|
||||
\ ale#Escape('poetry') . ' run flake8 --format=default --stdin-display-name %s -'
|
||||
|
||||
Execute(uv is detected when python_flake8_auto_uv is set):
|
||||
let g:ale_python_flake8_auto_uv = 1
|
||||
call ale#test#SetFilename('../test-files/python/uv/whatever.py')
|
||||
|
||||
AssertLinter 'uv',
|
||||
\ ale#Escape('uv') . ' run flake8 --format=default --stdin-display-name %s -'
|
||||
|
||||
@@ -201,3 +201,10 @@ Execute(poetry is detected when python_flakehell_auto_poetry is set):
|
||||
AssertLinterCwd ale#python#FindProjectRootIni(bufnr(''))
|
||||
AssertLinter 'poetry',
|
||||
\ ale#Escape('poetry') . ' run flakehell lint --format=default --stdin-display-name %s -'
|
||||
|
||||
Execute(uv is detected when python_flakehell_auto_uv is set):
|
||||
let g:ale_python_flakehell_auto_uv = 1
|
||||
call ale#test#SetFilename('../test-files/python/uv/whatever.py')
|
||||
|
||||
AssertLinter 'uv',
|
||||
\ ale#Escape('uv') . ' run flakehell lint --format=default --stdin-display-name %s -'
|
||||
|
||||
@@ -47,3 +47,17 @@ Execute(Setting executable to 'pipenv' appends 'run jedi-language-server'):
|
||||
call ale#test#SetFilename('../test-files/dummy')
|
||||
|
||||
AssertLinter 'path/to/pipenv', ale#Escape('path/to/pipenv') . ' run jedi-language-server'
|
||||
|
||||
Execute(poetry is detected when python_jedils_auto_poetry is set):
|
||||
let g:ale_python_jedils_auto_poetry = 1
|
||||
call ale#test#SetFilename('../test-files/python/poetry/whatever.py')
|
||||
|
||||
AssertLinter 'poetry',
|
||||
\ ale#Escape('poetry') . ' run jedi-language-server'
|
||||
|
||||
Execute(uv is detected when python_jedils_auto_uv is set):
|
||||
let g:ale_python_jedils_auto_uv = 1
|
||||
call ale#test#SetFilename('../test-files/python/uv/whatever.py')
|
||||
|
||||
AssertLinter 'uv',
|
||||
\ ale#Escape('uv') . ' run jedi-language-server'
|
||||
|
||||
@@ -104,3 +104,11 @@ Execute(Poetry is detected when python_mypy_auto_poetry is set):
|
||||
AssertLinterCwd expand('#' . bufnr('') . ':p:h')
|
||||
AssertLinter 'poetry',
|
||||
\ ale#Escape('poetry') . ' run mypy --show-column-numbers --shadow-file %s %t %s'
|
||||
|
||||
Execute(uv is detected when python_mypy_auto_uv is set):
|
||||
call ale#test#SetFilename('../test-files/python/uv/whatever.py')
|
||||
let g:ale_python_mypy_auto_uv = 1
|
||||
|
||||
AssertLinterCwd expand('#' . bufnr('') . ':p:h')
|
||||
AssertLinter 'uv',
|
||||
\ ale#Escape('uv') . ' run mypy --show-column-numbers --shadow-file %s %t %s'
|
||||
|
||||
@@ -33,3 +33,11 @@ Execute(Poetry is detected when python_prospector_auto_poetry is set):
|
||||
AssertLinter 'poetry',
|
||||
\ ale#Escape('poetry') . ' run prospector'
|
||||
\ . ' --messages-only --absolute-paths --zero-exit --output-format json %s'
|
||||
|
||||
Execute(uv is detected when python_prospector_auto_uv is set):
|
||||
let g:ale_python_prospector_auto_uv = 1
|
||||
call ale#test#SetFilename('../test-files/python/uv/whatever.py')
|
||||
|
||||
AssertLinter 'uv',
|
||||
\ ale#Escape('uv') . ' run prospector'
|
||||
\ . ' --messages-only --absolute-paths --zero-exit --output-format json %s'
|
||||
|
||||
@@ -97,6 +97,14 @@ Execute(poetry is detected when python_pycln_auto_poetry is set):
|
||||
AssertLinter 'poetry', ale#Escape('poetry') . ' run pycln'
|
||||
\ . b:cmd_tail
|
||||
|
||||
Execute(uv is detected when python_pycln_auto_uv is set):
|
||||
let g:ale_python_pycln_auto_uv = 1
|
||||
call ale#test#SetFilename('../test-files/python/uv/whatever.py')
|
||||
|
||||
AssertLinterCwd expand('%:p:h')
|
||||
AssertLinter 'uv', ale#Escape('uv') . ' run pycln'
|
||||
\ . b:cmd_tail
|
||||
|
||||
Execute(configuration files set in _config should be supported):
|
||||
let g:ale_python_pycln_config_file = ale#path#Simplify(g:dir . '/../test-files/pycln/other_config.xml')
|
||||
|
||||
|
||||
@@ -44,3 +44,10 @@ Execute(Poetry is detected when python_pycodestyle_auto_poetry is set):
|
||||
|
||||
AssertLinter 'poetry',
|
||||
\ ale#Escape('poetry') . ' run pycodestyle -'
|
||||
|
||||
Execute(uv is detected when python_pycodestyle_auto_uv is set):
|
||||
let g:ale_python_pycodestyle_auto_uv = 1
|
||||
call ale#test#SetFilename('../test-files/python/uv/whatever.py')
|
||||
|
||||
AssertLinter 'uv',
|
||||
\ ale#Escape('uv') . ' run pycodestyle -'
|
||||
|
||||
@@ -43,3 +43,9 @@ Execute(Poetry is detected when python_pydocstyle_auto_poetry is set):
|
||||
call ale#test#SetFilename('../test-files/python/poetry/whatever.py')
|
||||
|
||||
AssertLinter 'poetry', ale#Escape('poetry') . ' run pydocstyle %s'
|
||||
|
||||
Execute(uv is detected when python_pydocstyle_auto_uv is set):
|
||||
let g:ale_python_pydocstyle_auto_uv = 1
|
||||
call ale#test#SetFilename('../test-files/python/uv/whatever.py')
|
||||
|
||||
AssertLinter 'uv', ale#Escape('uv') . ' run pydocstyle %s'
|
||||
|
||||
@@ -58,3 +58,10 @@ Execute(Poetry is detected when python_pyflakes_auto_poetry is set):
|
||||
|
||||
AssertLinter 'poetry',
|
||||
\ ale#Escape('poetry') . ' run pyflakes %t'
|
||||
|
||||
Execute(uv is detected when python_pyflakes_auto_uv is set):
|
||||
let g:ale_python_pyflakes_auto_uv = 1
|
||||
call ale#test#SetFilename('../test-files/python/uv/whatever.py')
|
||||
|
||||
AssertLinter 'uv',
|
||||
\ ale#Escape('uv') . ' run pyflakes %t'
|
||||
|
||||
@@ -86,3 +86,9 @@ Execute(poetry is detected when python_pylama_auto_poetry is set):
|
||||
call ale#test#SetFilename('../test-files/python/poetry/whatever.py')
|
||||
|
||||
AssertLinter 'poetry', ale#Escape('poetry') . ' run pylama' . b:command_tail
|
||||
|
||||
Execute(uv is detected when python_pylama_auto_uv is set):
|
||||
let g:ale_python_pylama_auto_uv = 1
|
||||
call ale#test#SetFilename('../test-files/python/uv/whatever.py')
|
||||
|
||||
AssertLinter 'uv', ale#Escape('uv') . ' run pylama' . b:command_tail
|
||||
|
||||
@@ -94,3 +94,11 @@ Execute(poetry is detected when python_pylint_auto_poetry is set):
|
||||
AssertLinterCwd expand('%:p:h')
|
||||
AssertLinter 'poetry', ale#Escape('poetry') . ' run pylint'
|
||||
\ . ' --output-format text --msg-template="{path}:{line}:{column}: {msg_id} ({symbol}) {msg}" --reports n %s'
|
||||
|
||||
Execute(uv is detected when python_pylint_auto_uv is set):
|
||||
let g:ale_python_pylint_auto_uv = 1
|
||||
call ale#test#SetFilename('../test-files/python/uv/whatever.py')
|
||||
|
||||
AssertLinterCwd expand('%:p:h')
|
||||
AssertLinter 'uv', ale#Escape('uv') . ' run pylint'
|
||||
\ . ' --output-format text --msg-template="{path}:{line}:{column}: {msg_id} ({symbol}) {msg}" --reports n %s'
|
||||
|
||||
@@ -85,6 +85,13 @@ Execute(poetry is detected when python_pylsp_auto_poetry is set):
|
||||
AssertLinter 'poetry',
|
||||
\ ale#Escape('poetry') . ' run pylsp'
|
||||
|
||||
Execute(uv is detected when python_pylsp_auto_uv is set):
|
||||
let g:ale_python_pylsp_auto_uv = 1
|
||||
call ale#test#SetFilename('../test-files/python/uv/whatever.py')
|
||||
|
||||
AssertLinter 'uv',
|
||||
\ ale#Escape('uv') . ' run pylsp'
|
||||
|
||||
Execute(Should accept configuration settings):
|
||||
AssertLSPConfig {}
|
||||
let b:ale_python_pylsp_config = {'pylsp': {'plugins': {'preload': {'enabled': v:false}}}}
|
||||
|
||||
@@ -61,6 +61,13 @@ Execute(Poetry is detected when python_pyre_auto_poetry is set):
|
||||
AssertLinter 'poetry',
|
||||
\ ale#Escape('poetry') . ' run pyre persistent'
|
||||
|
||||
Execute(uv is detected when python_pyre_auto_uv is set):
|
||||
let g:ale_python_pyre_auto_uv = 1
|
||||
call ale#test#SetFilename('../test-files/python/uv/whatever.py')
|
||||
|
||||
AssertLinter 'uv',
|
||||
\ ale#Escape('uv') . ' run pyre persistent'
|
||||
|
||||
Execute(The FindProjectRoot should detect the project root directory for namespace package via .pyre_configuration.local):
|
||||
silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/pyre_configuration_dir/foo/bar.py')
|
||||
|
||||
|
||||
@@ -179,3 +179,10 @@ Execute(poetry is detected when python_pyright_auto_poetry is set):
|
||||
AssertLinterCwd ale#python#FindProjectRootIni(bufnr(''))
|
||||
AssertLinter 'poetry',
|
||||
\ ale#Escape('poetry') . ' run pyright-langserver --stdio'
|
||||
|
||||
Execute(uv is detected when python_pyright_auto_uv is set):
|
||||
let g:ale_python_pyright_auto_uv = 1
|
||||
call ale#test#SetFilename('../test-files/python/uv/whatever.py')
|
||||
|
||||
AssertLinter 'uv',
|
||||
\ ale#Escape('uv') . ' run pyright-langserver --stdio'
|
||||
|
||||
@@ -83,3 +83,10 @@ Execute(poetry is detected when python_refurb_auto_poetry is set):
|
||||
|
||||
AssertLinterCwd expand('%:p:h')
|
||||
AssertLinter 'poetry', ale#Escape('poetry') . ' run refurb %s'
|
||||
|
||||
Execute(uv is detected when python_refurb_auto_uv is set):
|
||||
let g:ale_python_refurb_auto_uv = 1
|
||||
call ale#test#SetFilename('../test-files/python/uv/whatever.py')
|
||||
|
||||
AssertLinterCwd expand('%:p:h')
|
||||
AssertLinter 'uv', ale#Escape('uv') . ' run refurb %s'
|
||||
|
||||
@@ -117,3 +117,11 @@ Execute(poetry is detected when python_ruff_auto_poetry is set):
|
||||
AssertLinterCwd expand('%:p:h')
|
||||
AssertLinter 'poetry', ale#Escape('poetry') . ' run ruff -q --no-fix'
|
||||
\ . b:command_tail
|
||||
|
||||
Execute(uv is detected when python_ruff_auto_uv is set):
|
||||
let g:ale_python_ruff_auto_uv = 1
|
||||
call ale#test#SetFilename('../test-files/python/uv/whatever.py')
|
||||
|
||||
AssertLinterCwd expand('%:p:h')
|
||||
AssertLinter 'uv', ale#Escape('uv') . ' run ruff -q --no-fix'
|
||||
\ . b:command_tail
|
||||
|
||||
@@ -69,3 +69,10 @@ Execute(Poetry is detected when python_unimport_auto_poetry is set):
|
||||
|
||||
AssertLinterCwd expand('#' . bufnr('') . ':p:h')
|
||||
AssertLinter 'poetry', ale#Escape('poetry') . ' run unimport --check %t'
|
||||
|
||||
Execute(uv is detected when python_unimport_auto_uv is set):
|
||||
call ale#test#SetFilename('../test-files/python/uv/whatever.py')
|
||||
let g:ale_python_unimport_auto_uv = 1
|
||||
|
||||
AssertLinterCwd expand('#' . bufnr('') . ':p:h')
|
||||
AssertLinter 'uv', ale#Escape('uv') . ' run unimport --check %t'
|
||||
|
||||
@@ -61,3 +61,25 @@ Execute(Setting executable to 'poetry' appends 'run vulture'):
|
||||
let g:ale_python_vulture_executable = 'path/to/poetry'
|
||||
|
||||
AssertLinter 'path/to/poetry', ale#Escape('path/to/poetry') . ' run vulture' . ' .'
|
||||
|
||||
Execute(pipenv is detected when python_vulture_auto_pipenv is set):
|
||||
call ale#test#SetFilename('../test-files/python/pipenv/whatever.py')
|
||||
let g:ale_python_vulture_auto_pipenv = 1
|
||||
|
||||
AssertLinter 'pipenv',
|
||||
\ ale#Escape('pipenv') . ' run vulture' . ' .'
|
||||
|
||||
|
||||
Execute(poetry is detected when python_vulture_auto_poetry is set):
|
||||
call ale#test#SetFilename('../test-files/python/poetry/whatever.py')
|
||||
let g:ale_python_vulture_auto_poetry = 1
|
||||
|
||||
AssertLinter 'poetry',
|
||||
\ ale#Escape('poetry') . ' run vulture' . ' .'
|
||||
|
||||
Execute(uv is detected when python_vulture_auto_uv is set):
|
||||
call ale#test#SetFilename('../test-files/python/uv/whatever.py')
|
||||
let g:ale_python_vulture_auto_uv = 1
|
||||
|
||||
AssertLinter 'uv',
|
||||
\ ale#Escape('uv') . ' run vulture' . ' .'
|
||||
|
||||
Reference in New Issue
Block a user