mirror of https://github.com/dense-analysis/ale
When ruff version is >=0.5.0 use 'ruff check <path>' instead of 'ruff <path>' (#4802)
This commit is contained in:
parent
a0ad5f938a
commit
a35fa4d732
|
@ -50,6 +50,11 @@ function! ale#fixers#ruff#FixForVersion(buffer, version) abort
|
||||||
call extend(l:cmd, ['run', 'ruff'])
|
call extend(l:cmd, ['run', 'ruff'])
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" NOTE: ruff 0.5.0 removes `ruff <path>` in favor of `ruff check <path>`
|
||||||
|
if ale#semver#GTE(a:version, [0, 5, 0])
|
||||||
|
call extend(l:cmd, ['check'])
|
||||||
|
endif
|
||||||
|
|
||||||
let l:options = ale#Var(a:buffer, 'python_ruff_options')
|
let l:options = ale#Var(a:buffer, 'python_ruff_options')
|
||||||
|
|
||||||
if !empty(l:options)
|
if !empty(l:options)
|
||||||
|
|
|
@ -73,6 +73,20 @@ Execute(The ruff callback should respect custom options):
|
||||||
\ . ' --ignore F401 -q --stdin-filename '. fname . ' --fix -',
|
\ . ' --ignore F401 -q --stdin-filename '. fname . ' --fix -',
|
||||||
\ }
|
\ }
|
||||||
|
|
||||||
|
Execute(The ruff callback should use ruff check for 0.5.0):
|
||||||
|
let file_path = g:dir . '/../test-files/python/with_virtualenv/subdir/foo/bar.py'
|
||||||
|
|
||||||
|
silent execute 'file ' . fnameescape(file_path)
|
||||||
|
|
||||||
|
let fname = ale#Escape(ale#path#Simplify(file_path))
|
||||||
|
|
||||||
|
GivenCommandOutput ['ruff 0.5.0']
|
||||||
|
AssertFixer
|
||||||
|
\ {
|
||||||
|
\ 'cwd': ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/subdir'),
|
||||||
|
\ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/ruff')) . ' check --stdin-filename ' . fname . ' --fix -',
|
||||||
|
\ }
|
||||||
|
|
||||||
Execute(Pipenv is detected when python_ruff_auto_pipenv is set):
|
Execute(Pipenv is detected when python_ruff_auto_pipenv is set):
|
||||||
let g:ale_python_ruff_auto_pipenv = 1
|
let g:ale_python_ruff_auto_pipenv = 1
|
||||||
let g:ale_python_ruff_change_directory = 0
|
let g:ale_python_ruff_change_directory = 0
|
||||||
|
|
Loading…
Reference in New Issue