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

Attempt to find selene.toml in parent directories #543

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ProspectPyxis
Copy link
Contributor

With this change, if the --config flag is not specified, selene will search the current directory and all parent directories for a selene.toml file, rather than only looking in the current directory.

This does not affect standard library file resolution - it is assumed that the standard library file is in the same directory as the config file.

Closes #526.

@chriscerie
Copy link
Collaborator

chriscerie commented Aug 12, 2023

This behavior should be added to docs. This is good, but this serves a different use case than #526.

I’m concerned about the case if the user accidentally adds a selene.toml in some ancestor directory, it may be difficult to debug why selene is not behaving in the way they expect. Should it output a message that it’s getting the config file in an ancestor directory?

@ProspectPyxis
Copy link
Contributor Author

ProspectPyxis commented Aug 13, 2023

I’m concerned about the case if the user accidentally adds a selene.toml in some ancestor directory, it may be difficult to debug why selene is not behaving in the way they expect. Should it output a message that it’s getting the config file in an ancestor directory?

I don't think this will be a problem - many other linters/formatters work the same way when locating their config files. If we're concerned for backwards compatibility, though, we could make this a --parent-config (name not final) command line flag.

@chriscerie
Copy link
Collaborator

If we're concerned for backwards compatibility, though, we could make this a --parent-config (name not final) command line flag.

My intuition says such cases where a config file exists somewhere higher but the user relies on default config values is much more likely locally (which an output would make it obvious why it's behaving differently) than in a controlled ci environment.

But at the very least document this behavior and link the pr to a relevant issue (not #526).

@cxwx
Copy link

cxwx commented May 1, 2024

still not merged?
I use ale for linting,but the neovim always change current dir when open directory.
So I really need the feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

VS Code extension does not use selene.toml from outside of its folder Subfolder selene.toml
3 participants