dense-analysis / ale

Check syntax in Vim/Neovim asynchronously and fix files, with Language Server Protocol (LSP) support
BSD 2-Clause "Simplified" License
13.51k stars 1.43k forks source link

ALE ruff format shows error: "Unidentified byte: Loading .env environment variables..." #4788

Open Flimm opened 4 months ago

Flimm commented 4 months ago

Information

VIM version

NVIM v0.10.0
Build type: Release

Operating System: Ubuntu 24.04

What went wrong

I'm running the ruff formatter for Python files. Ruff was installed using pipenv. I get this error displayed in Neovim:

Error detected while processing function <SNR>77_NeoVimCallback[35]..function <SNR>77_NeoVimCallback[29]..<lambda>125[1]..<SNR>76_ExitCallback[28]..<SNR>74_HandleExit[24]..ale_linters#py
thon#ruff#Handle:                                                                                                                                                                         
line    4:                                                                                                                                                                                
E474: Unidentified byte: Loading .env environment variables...

Reproducing the bug

  1. Install ruff using pipenv: pipenv install ruff
  2. Make sure a .env file exists
  3. Open a Python file in Neovim
  4. View the errors

:ALEInfo

Expand (finished - exit code 0) ['/bin/sh', '-c', 'cd ''/home/flimm/bla'' && ''pipenv'' run ruff format --stdin-filename ''bla/bla.py'' - < ''/tmp/nvim.song/00sSx2/6/bla.py''']

To fix this, pipenv needs to be called with the --quiet option.

Instead of running:

$ pipenv run ruff format --stdin-filename bla/bla.py -
Loading .env environment variables...
1 file left unchanged

It should run:

$ pipenv --quiet run ruff format --stdin-filename bla/bla.py -
1 file left unchanged