mirror of
https://github.com/dense-analysis/ale.git
synced 2026-02-03 00:22:51 +08:00
add: support for ruff as a Python linter and fixer (#4347)
this commit adds ruff as both a Python linter and fixer, together with some tests and documentation. ruff repo: https://github.com/charliermarsh/ruff
This commit is contained in:
@@ -1115,6 +1115,69 @@ g:ale_python_reorder_python_imports_use_global
|
||||
See |ale-integrations-local-executables|
|
||||
|
||||
|
||||
===============================================================================
|
||||
ruff *ale-python-ruff*
|
||||
|
||||
g:ale_python_ruff_change_directory *g:ale_python_ruff_change_directory*
|
||||
*b:ale_python_ruff_change_directory*
|
||||
Type: |Number|
|
||||
Default: `1`
|
||||
|
||||
If set to `1`, `ruff` will be run from a detected project root, per
|
||||
|ale-python-root|. if set to `0` or no project root detected,
|
||||
`ruff` will be run from the buffer's directory.
|
||||
|
||||
|
||||
g:ale_python_ruff_executable *g:ale_python_ruff_executable*
|
||||
*b:ale_python_ruff_executable*
|
||||
Type: |String|
|
||||
Default: `'ruff'`
|
||||
|
||||
See |ale-integrations-local-executables|
|
||||
|
||||
Set this to `'pipenv'` to invoke `'pipenv` `run` `ruff'`.
|
||||
Set this to `'poetry'` to invoke `'poetry` `run` `ruff'`.
|
||||
|
||||
|
||||
g:ale_python_ruff_options *g:ale_python_ruff_options*
|
||||
*b:ale_python_ruff_options*
|
||||
Type: |String|
|
||||
Default: `''`
|
||||
|
||||
This variable can be changed to add command-line arguments to the ruff
|
||||
invocation.
|
||||
|
||||
For example, to select/enable and/or disable some error codes,
|
||||
you may want to set >
|
||||
let g:ale_python_ruff_options = '--ignore F401'
|
||||
|
||||
|
||||
g:ale_python_ruff_use_global *g:ale_python_ruff_use_global*
|
||||
*b:ale_python_ruff_use_global*
|
||||
Type: |Number|
|
||||
Default: `get(g:, 'ale_use_global_executables', 0)`
|
||||
|
||||
See |ale-integrations-local-executables|
|
||||
|
||||
|
||||
g:ale_python_ruff_auto_pipenv *g:ale_python_ruff_auto_pipenv*
|
||||
*b:ale_python_ruff_auto_pipenv*
|
||||
Type: |Number|
|
||||
Default: `0`
|
||||
|
||||
Detect whether the file is inside a pipenv, and set the executable to `pipenv`
|
||||
if true. This is overridden by a manually-set executable.
|
||||
|
||||
|
||||
g:ale_python_ruff_auto_poetry *g:ale_python_ruff_auto_poetry*
|
||||
*b:ale_python_ruff_auto_poetry*
|
||||
Type: |Number|
|
||||
Default: `0`
|
||||
|
||||
Detect whether the file is inside a poetry, and set the executable to `poetry`
|
||||
if true. This is overridden by a manually-set executable.
|
||||
|
||||
|
||||
===============================================================================
|
||||
unimport *ale-python-unimport*
|
||||
|
||||
|
||||
@@ -483,6 +483,7 @@ Notes:
|
||||
* `pyre`
|
||||
* `pyright`
|
||||
* `reorder-python-imports`
|
||||
* ruff
|
||||
* `unimport`
|
||||
* `vulture`!!
|
||||
* `yapf`
|
||||
|
||||
@@ -3160,6 +3160,7 @@ documented in additional help files.
|
||||
pyre..................................|ale-python-pyre|
|
||||
pyright...............................|ale-python-pyright|
|
||||
reorder-python-imports................|ale-python-reorder_python_imports|
|
||||
ruff..................................|ale-python-ruff|
|
||||
unimport..............................|ale-python-unimport|
|
||||
vulture...............................|ale-python-vulture|
|
||||
yapf..................................|ale-python-yapf|
|
||||
|
||||
Reference in New Issue
Block a user