ruff won't stop fixing F401 when used with vim-ALE #4813
-
I'm not sure if this is a problem with how I'm using ruff or vim-ALE. If anyone else has experience with this setup, I'd appreciate it! Note that $ ruff --version && python --version
ruff 0.0.270
Python 3.11.2
$ ruff check list_pr_check_runs.py
list_pr_check_runs.py:8:8: F401 [*] `argparse` imported but unused
Found 1 error.
[*] 1 potentially fixable with the --fix option. ~/.config/ruff/pyproject.toml[tool.ruff]
target-version = "py310"
line-length = 79
select = [ "A", "B", "C", "D", "E", "F", "G", "I", "N", "Q", "S", "T", "W", "SIM9", "PIE", "ANN", "ARG", "BLE", "COM", "DJ", "DTZ", "EM", "ERA", "EXE", "FBT", "ICN", "INP", "ISC", "NPY", "PD", "PGH", "PIE", "PL", "PT", "PTH", "PYI", "RET", "RSE", "RUF", "SIM", "SLF", "TCH", "TID", "TRY", "UP", "YTT" ]
ignore = ["E123", "E133", "W503", "F401"]
unfixable = ["F401"]
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".mypy_cache",
".nox",
".pants.d",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"venv",
]
per-file-ignores = {}
# Allow unused variables when underscore-prefixed.
# dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
[tool.ruff.mccabe]
max-complexity = 10 ~/.vim/after/ftplugin/python.vimsetlocal wrapmargin=0 textwidth=0
setlocal foldmethod=indent foldlevel=999
setlocal expandtab shiftwidth=4 softtabstop=4
setlocal completeopt=menuone,preview
let b:python_highlight_all = 1
let b:python_slow_sync = 1
let b:ale_linters = {'python': ['flake8', 'mypy']}
let b:ale_fixers = {'python': ['black', 'ruff']}
let b:ale_fix_on_save = 1 " Enable fixing on save
" this must be 0 or else setup.cfg will sometimes not be loaded correctly
" for example, flake8 documentation errors in tests/*
let b:ale_python_flake8_change_directory=0
let b:ale_python_flake8_executable='flake8'
let b:ale_python_mypy_ignore_invalid_syntax = 1
let g:black_linelength = 79
setlocal formatprg=black\ -\ --quiet\ 2>>\ /tmp/black.err
setlocal formatexpr=
IndentGuidesEnable |
Beta Was this translation helpful? Give feedback.
Answered by
charliermarsh
Jun 2, 2023
Replies: 1 comment 1 reply
-
Hmm, Ruff may not be picking up your configuration file. We expect user-specific configuration files to be located in a slightly different place than you've included it there: https://beta.ruff.rs/docs/faq/#how-can-i-disable-ruffs-color-output. The other option is to find a way to pass |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
rpdelaney
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hmm, Ruff may not be picking up your configuration file. We expect user-specific configuration files to be located in a slightly different place than you've included it there: https://beta.ruff.rs/docs/faq/#how-can-i-disable-ruffs-color-output. The other option is to find a way to pass
--config ~/.config/ruff/pyproject.toml
to your Ruff invocation in vim-ALE.