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 mistakenly thinks `$HOME` is the project root for Python code #4636

Open lericson opened 11 months ago

lericson commented 11 months ago

Information

VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Sep 12 2023 09:31:27) macOS version - arm64

What went wrong

ALE mistakenly thinks $HOME is the project root for Python code.

Specifically, ALE tries to figure out the Python project root using ale#python#FindProjectRootIni which looks for a set of cue files (but not setup.py)

Because there is often a global .pylintrc in $HOME as in my case, ALE thinks that is the project root and a bunch of tools stop working correctly with this.

There is of course a possibility that $HOME is the project root, but it cannot be deduced by the fact that there exists a global configuration file for pylint.

I suggest stopping the Upwards at $HOME or something.

Reproducing the bug

Create a global pylintrc or one of the other dozen files listed in the function, have an oldstyle setup.py.

:ALEInfo

N/A

lericson commented 11 months ago

To be clear, if FindProjectRoot failed, all would be well. It is precisely the problem that it insists on $HOME actually being the project root that messes things up - all linter invocations for example will then first cd ~.

lericson commented 11 months ago

A second suggested fix is to add setup.py to the list of cue files. It seems an obvious, if not THE, candidate to me.