Kampfkarren/selene

Subfolder selene.toml

Commandcracker opened this issue · 3 comments

Explanation

I would like selen to handle selene.toml's in subfolders.

Example

📦project
 ┣ 📂spec
 ┃ ┣ 📜test_spec.lua -- should use /spec/selene.toml
 ┃ ┣ 📄busted.selene.yaml
 ┃ ┗ ⚙️selene.toml
 ┣ 📂src
 ┃ ┣ 📄cc-tweaked.selene.yaml
 ┃ ┣ 📜test.lua -- should use /src/selene.toml
 ┃ ┗ ⚙️selene.toml
 ┣ 📂some_folder
 ┃ ┗ 📜test.lua -- should use /selene.toml
 ┣ 📜test.lua -- should use /selene.toml
 ┗ ⚙️selene.toml

It would also be possible to have the main selene.toml say which std should be used at which folder, at least it would work for my use case but having subfolder selene.toml's might also be a good idea.

@Commandcracker Somewhat off-topic but did you write busted.selene.yaml yourself? I'm struggling to find a Selene configuration for it and was wondering if you'd like to share it?

I have a slightly different feature request that might be combined with this. What I want is an option to find a config file by searching upwards recursively from the directory containing the file I'm linting.

Consider the following directory structure:

foo/
  bar/
    selene.toml
    baz/
      hello.lua

If I run selene against hello.lua from the bar/ directory, the config file is detected, but if I run it from foo/ or baz/, it is not. I'd like it to detect selene.toml no matter where I run selene from.

This is relevant to me because I use selene inside neovim, which runs selene from the directory running neovim.

I could add logic to my neovim config to pass the appropriate --config flag to selene, but that's rather a hassle, and I expect enough others to have the same issue that I think it would be worth implementing this feature.

If I should open a separate issue though let me know.