You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
VIM - Vi IMproved 9.1 (2024 Jan 02, compiled Sep 25 2024 10:13:04)
Included patches: 1-16, 647, 678, 697
Operating System: Ubuntu 24.04
What went wrong
I'm using ruff linter and fixer for python files.
I have a project where the linter detects errors and the fixer doesn't.
I suspect that the difference comes from the fact that the path to the file provided for --stdin-filename is different. It's an absolute path for the linter whereas it's a relative one for the fixer.
Here are the commands that ALE uses to run the linter and fixer (copied and simplified from ALEInfo and simplified):
Additional note : in our project, the structure of files may be a bit specific. We have 2 packages, each with its own pyproject.toml file. The configuration file for ruff is at the root of the project.
It seems like given the path of the file (ie. relative), ruff doesn't use its configuration file. Also, I think the path is wrong: after the cd the path should actually be file.py, not lib/file.py.
:ALEInfo
Expand
Current Filetype: python
Available Linters: ['bandit', 'cspell', 'flake8', 'flakehell', 'jedils', 'mypy', 'prospector', 'pycln', 'pycodestyle', 'pydocstyle', 'pyflakes', 'pylama', 'pylint', 'pylsp', 'pyre', 'pyright', 'refurb', 'ruff', 'unimport', 'vulture']
Linter Aliases:
'jedils' -> ['jedi_language_server']
Enabled Linters: ['mypy', 'ruff']
Ignored Linters: []
Suggested Fixers:
'add_blank_lines_for_python_control_statements' - Add blank lines before control statements.
'autoflake' - Fix flake issues with autoflake.
'autoimport' - Fix import issues with autoimport.
'autopep8' - Fix PEP8 issues with autopep8.
'black' - Fix PEP8 issues with black.
'isort' - Sort Python imports with isort.
'pycln' - remove unused python import statements
'pyflyby' - Tidy Python imports with pyflyby.
'remove_trailing_lines' - Remove all blank lines at the end of a file.
'reorder-python-imports' - Sort Python imports with reorder-python-imports.
'ruff' - A python linter/fixer for Python written in Rust
'ruff_format' - Fix python files with the ruff formatter.
'trim_whitespace' - Remove all trailing whitespace characters at the end of every line.
'yapf' - Fix Python files with yapf.
Linter Variables:
" Press Space to read :help for a setting
let g:ale_python_auto_pipenv = 0
let g:ale_python_auto_poetry = 0
let g:ale_python_auto_uv = 0
let g:ale_python_auto_virtualenv = 0
let g:ale_python_mypy_auto_pipenv = 0
let g:ale_python_mypy_auto_poetry = 0
let g:ale_python_mypy_auto_uv = 0
let g:ale_python_mypy_executable = 'mypy'
let g:ale_python_mypy_ignore_invalid_syntax = 0
let g:ale_python_mypy_options = ''
let b:ale_python_mypy_options = '--strict --ignore-missing-imports'
let g:ale_python_mypy_show_notes = 1
let g:ale_python_mypy_use_global = 0
let g:ale_python_ruff_auto_pipenv = 0
let g:ale_python_ruff_auto_poetry = 0
let g:ale_python_ruff_auto_uv = 0
let g:ale_python_ruff_change_directory = 1
let g:ale_python_ruff_executable = 'ruff'
let g:ale_python_ruff_format_auto_pipenv = 0
let g:ale_python_ruff_format_auto_poetry = 0
let g:ale_python_ruff_format_auto_uv = 0
let g:ale_python_ruff_format_change_directory = 1
let g:ale_python_ruff_format_executable = 'ruff'
let g:ale_python_ruff_format_options = ''
let g:ale_python_ruff_format_use_global = 0
let g:ale_python_ruff_options = ''
let g:ale_python_ruff_use_global = 0
Global Variables:
" Press Space to read :help for a setting
let g:ale_cache_executable_check_failures = v:null
let g:ale_change_sign_column_color = 0
let g:ale_command_wrapper = ''
let g:ale_completion_delay = v:null
let g:ale_completion_enabled = 0
let g:ale_completion_max_suggestions = v:null
let g:ale_disable_lsp = 'auto'
let g:ale_echo_cursor = 1
let g:ale_echo_msg_error_str = 'Error'
let g:ale_echo_msg_format = '%code: %%s'
let g:ale_echo_msg_info_str = 'Info'
let g:ale_echo_msg_warning_str = 'Warning'
let g:ale_enabled = 1
let g:ale_fix_on_save = 1
let g:ale_fixers = {'vue': ['prettier'], 'javascript': ['prettier']}
let b:ale_fixers = ['ruff', 'ruff_format']
let g:ale_history_enabled = 1
let g:ale_info_default_mode = 'preview'
let g:ale_history_log_output = 1
let g:ale_keep_list_window_open = 0
let g:ale_lint_delay = 200
let g:ale_lint_on_enter = 1
let g:ale_lint_on_filetype_changed = 1
let g:ale_lint_on_insert_leave = 1
let g:ale_lint_on_save = 1
let g:ale_lint_on_text_changed = 'normal'
let g:ale_linter_aliases = {}
let g:ale_linters = {}
let b:ale_linters = ['mypy', 'ruff']
let g:ale_linters_explicit = 0
let g:ale_linters_ignore = {}
let g:ale_list_vertical = 0
let g:ale_list_window_size = 10
let g:ale_loclist_msg_format = '%code: %%s'
let g:ale_max_buffer_history_size = 20
let g:ale_max_signs = -1
let g:ale_maximum_file_size = v:null
let g:ale_open_list = 0
let g:ale_pattern_options = v:null
let g:ale_pattern_options_enabled = v:null
let g:ale_root = {}
let g:ale_set_balloons = 0
let g:ale_set_highlights = 1
let g:ale_set_loclist = 1
let g:ale_set_quickfix = 0
let g:ale_set_signs = 1
let g:ale_sign_column_always = 0
let g:ale_sign_error = 'E'
let g:ale_sign_info = 'I'
let g:ale_sign_offset = 1000000
let g:ale_sign_style_error = 'E'
let g:ale_sign_style_warning = 'W'
let g:ale_sign_warning = 'W'
let g:ale_sign_highlight_linenrs = 0
let g:ale_type_map = {}
let g:ale_use_neovim_diagnostics_api = 0
let g:ale_use_global_executables = v:null
let g:ale_virtualtext_cursor = 'all'
let g:ale_warn_about_trailing_blank_lines = 1
let g:ale_warn_about_trailing_whitespace = 1
Information
VIM - Vi IMproved 9.1 (2024 Jan 02, compiled Sep 25 2024 10:13:04)
Included patches: 1-16, 647, 678, 697
Operating System: Ubuntu 24.04
What went wrong
I'm using
ruff
linter and fixer for python files.I have a project where the linter detects errors and the fixer doesn't.
I suspect that the difference comes from the fact that the path to the file provided for
--stdin-filename
is different. It's an absolute path for the linter whereas it's a relative one for the fixer.Here are the commands that ALE uses to run the linter and fixer (copied and simplified from ALEInfo and simplified):
Additional note : in our project, the structure of files may be a bit specific. We have 2 packages, each with its own
pyproject.toml
file. The configuration file for ruff is at the root of the project.It seems like given the path of the file (ie. relative), ruff doesn't use its configuration file. Also, I think the path is wrong: after the
cd
the path should actually befile.py
, notlib/file.py
.:ALEInfo
Expand
Current Filetype: python Available Linters: ['bandit', 'cspell', 'flake8', 'flakehell', 'jedils', 'mypy', 'prospector', 'pycln', 'pycodestyle', 'pydocstyle', 'pyflakes', 'pylama', 'pylint', 'pylsp', 'pyre', 'pyright', 'refurb', 'ruff', 'unimport', 'vulture'] Linter Aliases: 'jedils' -> ['jedi_language_server'] Enabled Linters: ['mypy', 'ruff'] Ignored Linters: [] Suggested Fixers: 'add_blank_lines_for_python_control_statements' - Add blank lines before control statements. 'autoflake' - Fix flake issues with autoflake. 'autoimport' - Fix import issues with autoimport. 'autopep8' - Fix PEP8 issues with autopep8. 'black' - Fix PEP8 issues with black. 'isort' - Sort Python imports with isort. 'pycln' - remove unused python import statements 'pyflyby' - Tidy Python imports with pyflyby. 'remove_trailing_lines' - Remove all blank lines at the end of a file. 'reorder-python-imports' - Sort Python imports with reorder-python-imports. 'ruff' - A python linter/fixer for Python written in Rust 'ruff_format' - Fix python files with the ruff formatter. 'trim_whitespace' - Remove all trailing whitespace characters at the end of every line. 'yapf' - Fix Python files with yapf.Linter Variables:
" Press Space to read :help for a setting
let g:ale_python_auto_pipenv = 0
let g:ale_python_auto_poetry = 0
let g:ale_python_auto_uv = 0
let g:ale_python_auto_virtualenv = 0
let g:ale_python_mypy_auto_pipenv = 0
let g:ale_python_mypy_auto_poetry = 0
let g:ale_python_mypy_auto_uv = 0
let g:ale_python_mypy_executable = 'mypy'
let g:ale_python_mypy_ignore_invalid_syntax = 0
let g:ale_python_mypy_options = ''
let b:ale_python_mypy_options = '--strict --ignore-missing-imports'
let g:ale_python_mypy_show_notes = 1
let g:ale_python_mypy_use_global = 0
let g:ale_python_ruff_auto_pipenv = 0
let g:ale_python_ruff_auto_poetry = 0
let g:ale_python_ruff_auto_uv = 0
let g:ale_python_ruff_change_directory = 1
let g:ale_python_ruff_executable = 'ruff'
let g:ale_python_ruff_format_auto_pipenv = 0
let g:ale_python_ruff_format_auto_poetry = 0
let g:ale_python_ruff_format_auto_uv = 0
let g:ale_python_ruff_format_change_directory = 1
let g:ale_python_ruff_format_executable = 'ruff'
let g:ale_python_ruff_format_options = ''
let g:ale_python_ruff_format_use_global = 0
let g:ale_python_ruff_options = ''
let g:ale_python_ruff_use_global = 0
Global Variables:
" Press Space to read :help for a setting
let g:ale_cache_executable_check_failures = v:null
let g:ale_change_sign_column_color = 0
let g:ale_command_wrapper = ''
let g:ale_completion_delay = v:null
let g:ale_completion_enabled = 0
let g:ale_completion_max_suggestions = v:null
let g:ale_disable_lsp = 'auto'
let g:ale_echo_cursor = 1
let g:ale_echo_msg_error_str = 'Error'
let g:ale_echo_msg_format = '%code: %%s'
let g:ale_echo_msg_info_str = 'Info'
let g:ale_echo_msg_warning_str = 'Warning'
let g:ale_enabled = 1
let g:ale_fix_on_save = 1
let g:ale_fixers = {'vue': ['prettier'], 'javascript': ['prettier']}
let b:ale_fixers = ['ruff', 'ruff_format']
let g:ale_history_enabled = 1
let g:ale_info_default_mode = 'preview'
let g:ale_history_log_output = 1
let g:ale_keep_list_window_open = 0
let g:ale_lint_delay = 200
let g:ale_lint_on_enter = 1
let g:ale_lint_on_filetype_changed = 1
let g:ale_lint_on_insert_leave = 1
let g:ale_lint_on_save = 1
let g:ale_lint_on_text_changed = 'normal'
let g:ale_linter_aliases = {}
let g:ale_linters = {}
let b:ale_linters = ['mypy', 'ruff']
let g:ale_linters_explicit = 0
let g:ale_linters_ignore = {}
let g:ale_list_vertical = 0
let g:ale_list_window_size = 10
let g:ale_loclist_msg_format = '%code: %%s'
let g:ale_max_buffer_history_size = 20
let g:ale_max_signs = -1
let g:ale_maximum_file_size = v:null
let g:ale_open_list = 0
let g:ale_pattern_options = v:null
let g:ale_pattern_options_enabled = v:null
let g:ale_root = {}
let g:ale_set_balloons = 0
let g:ale_set_highlights = 1
let g:ale_set_loclist = 1
let g:ale_set_quickfix = 0
let g:ale_set_signs = 1
let g:ale_sign_column_always = 0
let g:ale_sign_error = 'E'
let g:ale_sign_info = 'I'
let g:ale_sign_offset = 1000000
let g:ale_sign_style_error = 'E'
let g:ale_sign_style_warning = 'W'
let g:ale_sign_warning = 'W'
let g:ale_sign_highlight_linenrs = 0
let g:ale_type_map = {}
let g:ale_use_neovim_diagnostics_api = 0
let g:ale_use_global_executables = v:null
let g:ale_virtualtext_cursor = 'all'
let g:ale_warn_about_trailing_blank_lines = 1
let g:ale_warn_about_trailing_whitespace = 1
Command History:
(executable check - success) /home/pierre/work/pglift/.venv/bin/mypy
(finished - exit code 0) ['/bin/sh', '-c', 'cd ''/home/pierre/work/pglift'' && ''/home/pierre/work/pglift/.venv/bin/mypy'' --strict --ignore-missing-imports --show-column-numbers --shadow-file ''/home/pierre/work/pglift/cli/src/pglift_cli/init.py'' ''/tmp/v8TjPzN/2/init.py'' ''/home/pierre/work/pglift/cli/src/pglift_cli/init.py''']
<<>>
Success: no issues found in 1 source file
<<>>
(executable check - success) /home/pierre/work/pglift/.venv/bin/ruff
(finished - exit code 0) ['/bin/sh', '-c', 'cd ''/home/pierre/work/pglift/cli'' && ''/home/pierre/work/pglift/.venv/bin/ruff'' --version']
<<>>
ruff 0.7.1
<<>>
(finished - exit code 0) ['/bin/sh', '-c', 'cd ''/home/pierre/work/pglift/cli'' && ''/home/pierre/work/pglift/.venv/bin/ruff'' check -q --no-fix --output-format json-lines --stdin-filename ''/home/pierre/work/pglift/cli/src/pglift_cli/init.py'' - < ''/tmp/v8TjPzN/3/init.py''']
<<>>
(finished - exit code 0) ['/bin/sh', '-c', 'cd ''/home/pierre/work/pglift'' && ''/home/pierre/work/pglift/.venv/bin/mypy'' --strict --ignore-missing-imports --show-column-numbers --shadow-file ''/home/pierre/work/pglift/cli/src/pglift_cli/init.py'' ''/tmp/v8TjPzN/10/init.py'' ''/home/pierre/work/pglift/cli/src/pglift_cli/init.py''']
<<>>
Success: no issues found in 1 source file
<<>>
(finished - exit code 1) ['/bin/sh', '-c', 'cd ''/home/pierre/work/pglift/cli'' && ''/home/pierre/work/pglift/.venv/bin/ruff'' check -q --no-fix --output-format json-lines --stdin-filename ''/home/pierre/work/pglift/cli/src/pglift_cli/init.py'' - < ''/tmp/v8TjPzN/11/init.py''']
<<>>
{"cell":null,"code":"I001","end_location":{"column":1,"row":10},"filename":"/home/pierre/work/pglift/cli/src/pglift_cli/init.py","fix":{"applicability":"safe","edits":[{"content":"import logging\nimport os\n\nimport pluggy\n\n","end_location":{"column":1,"row":10},"location":{"column":1,"row":5}}],"message":"Organize imports"},"location":{"column":1,"row":5},"message":"Import block is un-sorted or un-formatted","noqa_row":5,"url":"https://docs.astral.sh/ruff/rules/unsorted-imports"}
<<>>
(finished - exit code 0) ['/bin/sh', '-c', 'cd ''/home/pierre/work/pglift/cli'' && ''/home/pierre/work/pglift/.venv/bin/ruff'' check --stdin-filename ''cli/src/pglift_cli/init.py'' --fix - < ''/tmp/v8TjPzN/12/init.py''']
(finished - exit code 0) ['/bin/sh', '-c', 'cd ''/home/pierre/work/pglift/cli'' && ''/home/pierre/work/pglift/.venv/bin/ruff'' format --stdin-filename ''cli/src/pglift_cli/init.py'' - < ''/tmp/v8TjPzN/13/init.py''']
(finished - exit code 0) ['/bin/sh', '-c', 'cd ''/home/pierre/work/pglift'' && ''/home/pierre/work/pglift/.venv/bin/mypy'' --strict --ignore-missing-imports --show-column-numbers --shadow-file ''/home/pierre/work/pglift/cli/src/pglift_cli/init.py'' ''/tmp/v8TjPzN/14/init.py'' ''/home/pierre/work/pglift/cli/src/pglift_cli/init.py''']
<<>>
Success: no issues found in 1 source file
<<>>
(finished - exit code 1) ['/bin/sh', '-c', 'cd ''/home/pierre/work/pglift/cli'' && ''/home/pierre/work/pglift/.venv/bin/ruff'' check -q --no-fix --output-format json-lines --stdin-filename ''/home/pierre/work/pglift/cli/src/pglift_cli/init.py'' - < ''/tmp/v8TjPzN/15/init.py''']
<<>>
{"cell":null,"code":"I001","end_location":{"column":1,"row":10},"filename":"/home/pierre/work/pglift/cli/src/pglift_cli/init.py","fix":{"applicability":"safe","edits":[{"content":"import logging\nimport os\n\nimport pluggy\n\n","end_location":{"column":1,"row":10},"location":{"column":1,"row":5}}],"message":"Organize imports"},"location":{"column":1,"row":5},"message":"Import block is un-sorted or un-formatted","noqa_row":5,"url":"https://docs.astral.sh/ruff/rules/unsorted-imports"}
<<>>
The text was updated successfully, but these errors were encountered: