ignore .ale-not-project-root directories during determine Python Proj…#4991
ignore .ale-not-project-root directories during determine Python Proj…#4991mangin wants to merge 1 commit intodense-analysis:masterfrom
Conversation
w0rp
left a comment
There was a problem hiding this comment.
This is a bit too hacky. I've prefer tweaking this a bit better to match project roots, possibly removing some of the old files we used to test for. I removed pytest.ini this morning, for example.
|
I tend to discourage configurations that might change behaviour in ALE specifically in a committed project file. |
|
You're right — our current approach to determining the Python project root is admittedly a bit hacky, and it's true that we already rely on committed project files for this behavior. Right now, we walk up from "the file" until we hit a known config file, which works well for most projects. I understand the logic behind it — it's a simple heuristic that covers a lot of cases. That said, some projects can be structured in less conventional ways, and this method can be too optimistic. Personally, I’d like to have some mechanism to override or customize this behavior when needed. Do you have any thoughts on how we could allow users to explicitly set or override the Python project root? |
|
Let's change the behavior actually to prefer the value of the
Theoretically a breaking change, but a change for the better. For fun I'll set OpenAI Codex to the task and see how well it does... |
|
I'll close this one. See the draft of the other option I proposed here. |
…ect directory
Here’s a clearer and more polished version of your GitHub PR description, with improved grammar, clarity, and structure:
Problem
In our monorepo, we have a structure like this:
When using ALE (Asynchronous Lint Engine) for linting, it automatically determines the Python project root by locating the first directory that contains a Python config file (e.g.,
setup.cfg,pyproject.toml, etc.).However, in our setup, this behavior can be problematic. For example, ALE may incorrectly treat the top-level
mono_repo/project_*/setup.cfgas the root, instead of one of the nestedmono_repodirectory. This prevents us from applying linter rules defined at the project level.Proposed Solution
To address this, I propose introducing a marker file named
.ale-not-project-root. When ALE encounters this file, it will skip that directory as a potential Python project root and continue "searching deeper."Example Use Case
With this marker, ALE will skip
mono_repo/project_1andmono_repo/project_2and use thesetup.cfgfrom the root.Feedback
Does this approach sound reasonable? Happy to discuss alternatives or improvements.