mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-06 12:44:23 +08:00
fixes ruff#GetCommand checking packagemanger verison and not ruff (#5026)
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--lua-only) (push) Has been cancelled
CI / test_ale (--neovim-07-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 (--lua-only) (push) Has been cancelled
CI / test_ale (--neovim-07-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:
@@ -34,6 +34,22 @@ function! ale_linters#python#ruff#GetExecutable(buffer) abort
|
||||
return ale#python#FindExecutable(a:buffer, 'python_ruff', ['ruff'])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#python#ruff#RunWithVersionCheck(buffer) abort
|
||||
let l:executable = ale_linters#python#ruff#GetExecutable(a:buffer)
|
||||
let l:exec_args = l:executable =~? '\(pipenv\|poetry\|uv\)$'
|
||||
\ ? ' run ruff'
|
||||
\ : ''
|
||||
|
||||
let l:command = ale#Escape(l:executable) . l:exec_args . ' --version'
|
||||
|
||||
return ale#semver#RunWithVersionCheck(
|
||||
\ a:buffer,
|
||||
\ l:executable,
|
||||
\ l:command,
|
||||
\ function('ale_linters#python#ruff#GetCommand'),
|
||||
\)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#python#ruff#GetCwd(buffer) abort
|
||||
if ale#Var(a:buffer, 'python_ruff_change_directory')
|
||||
" Run from project root if found, else from buffer dir.
|
||||
@@ -110,12 +126,7 @@ call ale#linter#Define('python', {
|
||||
\ 'name': 'ruff',
|
||||
\ 'executable': function('ale_linters#python#ruff#GetExecutable'),
|
||||
\ 'cwd': function('ale_linters#python#ruff#GetCwd'),
|
||||
\ 'command': {buffer -> ale#semver#RunWithVersionCheck(
|
||||
\ buffer,
|
||||
\ ale_linters#python#ruff#GetExecutable(buffer),
|
||||
\ '%e --version',
|
||||
\ function('ale_linters#python#ruff#GetCommand'),
|
||||
\ )},
|
||||
\ 'command': function('ale_linters#python#ruff#RunWithVersionCheck'),
|
||||
\ 'callback': 'ale_linters#python#ruff#Handle',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'read_buffer': 1,
|
||||
|
||||
Reference in New Issue
Block a user