Skip to content

Commit

Permalink
Merge branch 'master' into add_ruff_format
Browse files Browse the repository at this point in the history
  • Loading branch information
crimsonknave committed Nov 13, 2023
2 parents 5c2fdbe + 50e237f commit 7118745
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ See `:help ale-symbol-search` for more information.

### Refactoring: Rename, Actions

ALE supports renaming symbols in symbols in code such as variables or class
ALE supports renaming symbols in code such as variables or class
names with the `ALERename` command.

`ALEFileRename` will rename file and fix import paths (tsserver
Expand Down
5 changes: 3 additions & 2 deletions ale_linters/python/ruff.vim
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ function! ale_linters#python#ruff#GetCommand(buffer, version) abort
\ : ''

" NOTE: ruff version `0.0.69` supports liniting input from stdin
" NOTE: ruff version `0.1.0` deprecates `--format text`
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]) ? ' --stdin-filename %s -' : ' %s')
\ . (ale#semver#GTE(a:version, [0, 1, 0]) ? ' --output-format text' : ' --format text')
\ . (ale#semver#GTE(a:version, [0, 0, 69]) ? ' --stdin-filename %s -' : ' %s')
endfunction

function! ale_linters#python#ruff#Handle(buffer, lines) abort
Expand Down
6 changes: 6 additions & 0 deletions test/linter/test_ruff.vader
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ Execute(ruff should run with the file path of buffer in old versions):
AssertLinterCwd expand('%:p:h')
AssertLinter 'ruff', ale#Escape('ruff') . b:command_tail[:-23] . ' %s'

Execute(ruff should run with the --output-format flag in new versions):
GivenCommandOutput ['ruff 0.1.0']

AssertLinterCwd expand('%:p:h')
AssertLinter 'ruff', ale#Escape('ruff') . ' --output-format text --stdin-filename %s -'

Execute(ruff should run with the stdin in new enough versions):
GivenCommandOutput ['ruff 0.0.83']

Expand Down

0 comments on commit 7118745

Please sign in to comment.