Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't use global Python linter/fixer path if any python_auto_* option is set #4879

Open
Shados opened this issue Dec 15, 2024 · 0 comments
Open
Labels

Comments

@Shados
Copy link

Shados commented Dec 15, 2024

Information

VIM version

NVIM v0.11.0-nightly+852954f
Build type: Release

Operating System: NixOS unstable

What went wrong

It doesn't appear to be possible to use a specifically-configured _executable option for many (any?) of the Python linters/fixers if you have python_auto_pipenv, python_auto_poetry, or python_auto_uv set and one of those is actually present. This is a problem if you do want to be able to use locally-supplied tools by default, but need to provide a globally-supplied tool for some specific case.

Reproducing the bug

  1. Have the following set:
    let g:ale_python_auto_poetry = 1
    let g:ale_python_flake8_use_global = 1
  2. Go open a Python file in a project that is using Poetry.
  3. Check :ALEInfo, note that it is calling ... ''poetry'' run flake8 ... instead of using the executable name/path from g:ale_python_flake8_executable as the documentation for g:ale_python_flake8_use_global states it should.

: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: ['flake8', 'mypy']
  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:
let g:ale_python_auto_pipenv = 1
let g:ale_python_auto_poetry = 1
let g:ale_python_auto_uv = 1
let g:ale_python_auto_virtualenv = 0
let g:ale_python_flake8_auto_pipenv = 0
let g:ale_python_flake8_auto_poetry = 0
let g:ale_python_flake8_auto_uv = 0
let g:ale_python_flake8_change_directory = 'project'
let g:ale_python_flake8_executable = 'flake8'
let g:ale_python_flake8_options = ''
let g:ale_python_flake8_use_global = 1
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 g:ale_python_mypy_show_notes = 1
let g:ale_python_mypy_use_global = 0
 
 Global Variables:
let g:ale_cache_executable_check_failures = v:null
let g:ale_change_sign_column_color = 1
let g:ale_command_wrapper = ''
let g:ale_completion_delay = 100
let g:ale_completion_enabled = 1
let g:ale_completion_max_suggestions = 50
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 = 0
let b:ale_fix_on_save = 1
let g:ale_fixers = {'c': ['cppcheck', 'clangtidy'], 'typescript': ['prettier'], 'go': ['gofmt'], 'perl': ['perltidy'], 'json': ['prettier'], 'sh': ['shfmt'], 'javascript': ['prettier'], 'ocaml': ['ocamlformat'], 'python': ['isort', 'black']}
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 = {'javascript': ['eslint', 'jshint'], 'scss': [], 'sh': [], 'cython': ['cython'], 'go': [], 'lua': ['luac', 'luacheck'], 'yaml': ['yamllint'], 'python': ['flake8', 'mypy'], 'yue': ['yuecheck'], 'vim': ['vint'], 'nix': ['nix'], 'moon': ['moonpick'], 'less': [], 'sass': [], 'perl': ['perlcritic'], 'ruby': [], 'css': []}
let g:ale_linters_explicit = 1
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 = v:null
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 = v:null
let g:ale_sign_error = v:null
let g:ale_sign_info = v:null
let g:ale_sign_offset = v:null
let g:ale_sign_style_error = v:null
let g:ale_sign_style_warning = v:null
let g:ale_sign_warning = v:null
let g:ale_sign_highlight_linenrs = v:null
let g:ale_type_map = {}
let g:ale_use_neovim_diagnostics_api = 1
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) poetry
(finished - exit code 0) ['/nix/store/717iy55ncqs0wmhdkwc5fg2vci5wbmq8-bash-5.2p32/bin/bash', '-c', 'cd ''/home/redacted/some-python-project'' && ''poetry'' --version']

<<<OUTPUT STARTS>>>
Poetry (version 1.8.4)
<<<OUTPUT ENDS>>>

(finished - exit code 0) ['/nix/store/717iy55ncqs0wmhdkwc5fg2vci5wbmq8-bash-5.2p32/bin/bash', '-c', 'cd ''/home/redacted/some-python-project'' && ''poetry'' run mypy --show-column-numbers --shadow-file ''/home/redacted/some-python-project/some_python_project/__init__.py'' ''/tmp/nvim.redacted/CJezqg/1/__init__.py'' ''/home/redacted/some-python-project/some_python_project/__init__.py''']

<<<OUTPUT STARTS>>>
Success: no issues found in 1 source file
<<<OUTPUT ENDS>>>

(finished - exit code 1) ['/nix/store/717iy55ncqs0wmhdkwc5fg2vci5wbmq8-bash-5.2p32/bin/bash', '-c', 'cd ''/home/redacted/some-python-project'' && ''poetry'' run flake8 --format=default - < ''/tmp/nvim.redacted/CJezqg/2/__init__.py''']

<<<OUTPUT STARTS>>>
stdin:1:1: F401 'logging' imported but unused
<<<OUTPUT ENDS>>>
@Shados Shados added the bug label Dec 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant