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

Errors when opening fugitive.vim buffers (diff, staged, specific commit versions, etc) #4715

Open
dmedvinsky opened this issue Feb 1, 2024 · 1 comment
Labels

Comments

@dmedvinsky
Copy link

Information

VIM version

NVIM v0.9.5
Build type: Release

Operating System: macOS Sonoma 14.3

What went wrong

When opening a fugitive.vim buffer (simplest one is doing a git diff via :Gdiffsplit), I'm getting errors

Error detected while processing function <SNR>83_NeoVimCallback[35]..function <SNR>83_NeoVimCallback[29]..<lambda>59[1]..<SNR>77_ExitCallbac
k[28]..<SNR>76_HandleExit[24]..ale_linters#python#ruff#Handle:
line    4:
E474: Unidentified byte: /bin/sh: line 0: cd: fugitive:/Users/dmedvinsky/src/test/.git/0: No such file or directory
Press ENTER or type command to continue
Error detected while processing function <SNR>83_NeoVimCallback[35]..function <SNR>83_NeoVimCallback[29]..<lambda>59[1]..<SNR>77_ExitCallbac
k[28]..<SNR>76_HandleExit[24]..ale_linters#python#ruff#Handle:
line    4:
E474: Failed to parse /bin/sh: line 0: cd: fugitive:/Users/dmedvinsky/src/test/.git/0: No such file or directory

If I set let g:ale_python_ruff_change_directory = 0 in my config, the error goes away. But I still think this is an issue that might need fixing. Pardon me if I'm wrong about that.

Reproducing the bug

  1. Have nvim with fugitive and Ale configured to run linters like ruff (not sure if it's specific to ruff one, but looks like it affects all linters that do cd).
  2. Create a git repo.
  3. Edit an Ale-checked file in a repo.
  4. Do :Gdiffsplit
  5. Observe errors

: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: ['jedils', '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:
let g:ale_python_auto_pipenv = 0
let g:ale_python_auto_poetry = 0
let g:ale_python_auto_virtualenv = 0
let g:ale_python_jedils_auto_pipenv = 0
let g:ale_python_jedils_executable = 'jedi-language-server'
let g:ale_python_jedils_use_global = 0
let g:ale_python_mypy_auto_pipenv = 0
let g:ale_python_mypy_auto_poetry = 0
let g:ale_python_mypy_executable = 'mypy'
let g:ale_python_mypy_ignore_invalid_syntax = 1
let g:ale_python_mypy_options = ''
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_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_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:
let g:ale_cache_executable_check_failures = v:null
let g:ale_change_sign_column_color = v:null
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 = 1
let g:ale_fixers = {'*': ['remove_trailing_lines', 'trim_whitespace'], 'python': ['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 = {'python': ['ruff', 'mypy', 'jedils']}
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 = 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 = 1
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:

(started) ['/bin/sh', '-c', '''/Users/dmedvinsky/src/mel/.direnv/python-3.10/bin/jedi-language-server''']
(finished - exit code 1) ['/bin/sh', '-c', 'cd ''fugitive:/Users/dmedvinsky/src/mel/.git/0/dotcom/src/django/apps/accounts/forms'' && ''/Users/dmedvinsky/src/mel/.direnv/python-3.10/bin/mypy'' --show-column-numbers --shadow-file ''fugitive:///Users/dmedvinsky/src/mel/.git//0/dotcom/src/django/apps/accounts/forms/profile_signup.py'' ''/var/folders/rd/p7b3tb9j3659b5wklgs64znw0000gn/T/nvim.dmedvinsky/9mBsQL/372/profile_signup.py'' ''fugitive:///Users/dmedvinsky/src/mel/.git//0/dotcom/src/django/apps/accounts/forms/profile_signup.py''']

<<>>
/bin/sh: line 0: cd: fugitive:/Users/dmedvinsky/src/mel/.git/0/dotcom/src/django/apps/accounts/forms: No such file or directory
<<>>

(finished - exit code 1) ['/bin/sh', '-c', 'cd ''fugitive:/Users/dmedvinsky/src/mel/.git/0/dotcom/src/django/apps/accounts/forms'' && ''/Users/dmedvinsky/src/mel/.direnv/python-3.10/bin/ruff'' -q --output-format json-lines --stdin-filename ''fugitive:///Users/dmedvinsky/src/mel/.git//0/dotcom/src/django/apps/accounts/forms/profile_signup.py'' - < ''/var/folders/rd/p7b3tb9j3659b5wklgs64znw0000gn/T/nvim.dmedvinsky/9mBsQL/373/profile_signup.py''']

<<>>
/bin/sh: line 0: cd: fugitive:/Users/dmedvinsky/src/mel/.git/0/dotcom/src/django/apps/accounts/forms: No such file or directory
<<>>

</details>
@dmedvinsky dmedvinsky added the bug label Feb 1, 2024
@ferdinandyb
Copy link

I also ran into this. Does setting let g:ale_python_ruff_change_directory = 0 have any downside in general?

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

2 participants