Feature: Extend ruff configuration from external fileΒ #12352
Description
TD;LR
Enable the ability to import ruff.toml configurations from external sources such as URLs or git repositories.
β I am willing to contribute to make this feature.
Use Case
In our own projects, we maintain multiple repositories. When we need to update our linting rules, we currently have to modify the ruff.toml file in each project individually. This process is time-consuming and prone to inconsistencies. It would be beneficial to centralize these configurations, allowing us to update rules in a single location and propagate them across all projects.
For our Javascript projects, we have a shared eslint configuration from a repository that is imported via a project dependency. When we make an update to the configuration, the dependency will update. It saves us a lot of time, and I think Ruff should have a similar solution available for this case.
Proposed Solution
Introduce support for remote imports in ruff.toml. This feature would allow users to specify an external URL or git repository from which the ruff.toml configuration can be fetched and extended. This could be implemented either as a Python dependency or directly in the ruff.toml file.
Example Configuration
# ruff.toml
[import]
url = "https://example.com/path/to/ruff.toml"
# or for git repository
[import]
git = "https://github.com/organization/repo"
branch = "main"
path = "path/to/ruff.toml"
# Local overrides
[tool.ruff]
line-length = 88
Conclusion
This feature would streamline the process of sharing and updating linter configurations across multiple projects, enhancing maintainability and consistency. Centralizing configuration management would save time and reduce errors. Thank you for your continued efforts and a brilliant tool π