diff options
author | Actionless Loveless <actionless.loveless@gmail.com> | 2023-01-27 01:03:41 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-27 09:03:41 +0900 |
commit | 26c79014f52b0306ec619666bc73766f22621edb (patch) | |
tree | a94983a593b4dfefcf38a700337c63e9f9edcb9d | |
parent | 69c1dc8b5f3d215d4a0538265b2d257c2ed7a8fa (diff) | |
download | ale-26c79014f52b0306ec619666bc73766f22621edb.zip |
fix(ale_linters: python: ruff): add --stdin-filename if version > 0.0.69 (#4414)
-rw-r--r-- | ale_linters/python/ruff.vim | 2 | ||||
-rw-r--r-- | test/linter/test_ruff.vader | 12 |
2 files changed, 7 insertions, 7 deletions
diff --git a/ale_linters/python/ruff.vim b/ale_linters/python/ruff.vim index 67595fe3..34db0899 100644 --- a/ale_linters/python/ruff.vim +++ b/ale_linters/python/ruff.vim @@ -49,7 +49,7 @@ function! ale_linters#python#ruff#GetCommand(buffer, version) abort return ale#Escape(l:executable) . l:exec_args \ . ale#Pad(ale#Var(a:buffer, 'python_ruff_options')) \ . ' --format text' - \ . (ale#semver#GTE(a:version, [0, 0, 69]) ? ' -' : ' %s') + \ . (ale#semver#GTE(a:version, [0, 0, 69]) ? ' --stdin-filename %s -' : ' %s') endfunction function! ale_linters#python#ruff#Handle(buffer, lines) abort diff --git a/test/linter/test_ruff.vader b/test/linter/test_ruff.vader index 818253dd..efc9d869 100644 --- a/test/linter/test_ruff.vader +++ b/test/linter/test_ruff.vader @@ -6,7 +6,7 @@ Before: call ale#assert#SetUpLinterTest('python', 'ruff') let b:bin_dir = has('win32') ? 'Scripts' : 'bin' - let b:command_tail = ' --format text -' + let b:command_tail = ' --format text --stdin-filename %s -' GivenCommandOutput ['ruff 0.0.83'] @@ -26,7 +26,7 @@ Execute(ruff should run with the file path of buffer in old versions): GivenCommandOutput ['ruff 0.0.68'] AssertLinterCwd expand('%:p:h') - AssertLinter 'ruff', ale#Escape('ruff') . b:command_tail[:-3] . ' %s' + AssertLinter 'ruff', ale#Escape('ruff') . b:command_tail[:-23] . ' %s' Execute(ruff should run with the stdin in new enough versions): GivenCommandOutput ['ruff 0.0.83'] @@ -79,7 +79,7 @@ Execute(Setting executable to 'pipenv' appends 'run ruff'): let g:ale_python_ruff_use_global = 1 AssertLinter 'path/to/pipenv', ale#Escape('path/to/pipenv') . ' run ruff' - \ . ' --format text -' + \ . b:command_tail Execute(Pipenv is detected when python_ruff_auto_pipenv is set): let g:ale_python_ruff_auto_pipenv = 1 @@ -87,14 +87,14 @@ Execute(Pipenv is detected when python_ruff_auto_pipenv is set): AssertLinterCwd expand('%:p:h') AssertLinter 'pipenv', ale#Escape('pipenv') . ' run ruff' - \ . ' --format text -' + \ . b:command_tail Execute(Setting executable to 'poetry' appends 'run ruff'): let g:ale_python_ruff_executable = 'path/to/poetry' let g:ale_python_ruff_use_global = 1 AssertLinter 'path/to/poetry', ale#Escape('path/to/poetry') . ' run ruff' - \ . ' --format text -' + \ . b:command_tail Execute(poetry is detected when python_ruff_auto_poetry is set): let g:ale_python_ruff_auto_poetry = 1 @@ -102,4 +102,4 @@ Execute(poetry is detected when python_ruff_auto_poetry is set): AssertLinterCwd expand('%:p:h') AssertLinter 'poetry', ale#Escape('poetry') . ' run ruff' - \ . ' --format text -' + \ . b:command_tail |