selene icon indicating copy to clipboard operation
selene copied to clipboard

Attempt to find `selene.toml` in parent directories

Open ProspectPyxis opened this issue 2 years ago • 4 comments

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.

ProspectPyxis avatar Aug 12 '23 10:08 ProspectPyxis

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?

chriscerie avatar Aug 12 '23 17:08 chriscerie

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.

ProspectPyxis avatar Aug 13 '23 06:08 ProspectPyxis

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).

chriscerie avatar Oct 11 '23 20:10 chriscerie

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

cxwx avatar May 01 '24 08:05 cxwx