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

Extend configuration from another file #1129

Open
jvacek opened this issue Oct 22, 2024 · 2 comments
Open

Extend configuration from another file #1129

jvacek opened this issue Oct 22, 2024 · 2 comments
Labels
question Uncertainty is involved

Comments

@jvacek
Copy link

jvacek commented Oct 22, 2024

I'd like to have the entire configuration for typos shared among multiple repositories as a base, and be able to override those options locally after inheriting.

It would be nice if there was an option in the config file to extend from another config file, much like ruff or pyright does.

Currently, for ruff, I can for example do something like this in my pyproject.toml (docs)

[tool.ruff]
extend = ".company-submodule/ruff.toml"
line-length = 150

For typos, I would expect it to look something like

[tool.typos]
extend = ".company-submodule/typos.toml"

[tool.typos.default]
locale = 'en-gb'

Where the locale inherited from the submodule's typos.toml would be overwritten by the locally declared en-gb

This would imply the following order for sourcing:

  1. Command line arguments
  2. File specified via --config PATH
  3. Search parents of specified file / directory for one of typos.toml, _typos.toml, .typos.toml, Cargo.toml, or pyproject.toml.
    1. Directly in the config file
    2. Inherited from an extended config file
@jvacek
Copy link
Author

jvacek commented Oct 22, 2024

In regards to #931, supporting something like this would allow people to write/generate their own files like false_positives.toml which they can then include/share as well, and you don't have to support some additional format for config

@epage epage added the question Uncertainty is involved label Oct 22, 2024
@epage
Copy link
Collaborator

epage commented Oct 22, 2024

#193 is our issue for layered config but that is more focused on implicitly extending directories above the current one, rather than specifying them from another location.

Personally, I use a template repo for keeping everything in sync (see https://github.com/epage/_rust) as most tools do not support the type of extension needed for centralizing like this and supporting it in every tools seems like it could get messy.

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

No branches or pull requests

2 participants