astral-sh / ruff

An extremely fast Python linter and code formatter, written in Rust.
https://docs.astral.sh/ruff
MIT License
32.54k stars 1.08k forks source link

Allow default configuration for integrators #8737

Open ofek opened 11 months ago

ofek commented 11 months ago

I am integrating with Ruff and wish to provide out-of-the-box configuration that users can override if they wish. Essentially, a flag to set the extend option like --config-extend would be perfect.

My use case is a new fmt command for Hatch but I imagine others would wish to integrate in a similar way, like Visual Studio Code.

ofek commented 11 months ago

Would this be easy to implement?

MichaReiser commented 11 months ago

I'm not sure about the implementation complexity and I see your use case. A related issue is that larger projects want to share some configuration across projects that may be stored in different git repositories. I started looking into this in March but have since then be busy implementing the formatter. The main idea is that you can specify a named configuration (git URL / python package name / or something else) in extend. I believe that could solve your use case too:

T-256 commented 8 months ago

@ofek Does https://github.com/astral-sh/ruff/pull/9599 solve your issue?

ofek commented 8 months ago

Thanks for the heads up! Unfortunately it does not work: https://github.com/astral-sh/ruff/issues/10035