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

[Feature Request] User-Defined Deprecations? #12693

Closed
alanhdu opened this issue Aug 5, 2024 · 2 comments
Closed

[Feature Request] User-Defined Deprecations? #12693

alanhdu opened this issue Aug 5, 2024 · 2 comments

Comments

@alanhdu
Copy link
Contributor

alanhdu commented Aug 5, 2024

This is probably a big feature request (and apologies if it has already been asked about), but I am wondering whether there are plans for ruff to allow user-defined / config-defied lint rules?

In particular, I have some internal codebase functions that are deprecated and would like people to move off of. I can certainly try to write a custom CI rule for this, but it'd be super nice if I could somehow configure ruff to detect this (since it's already integrated into our CI).

I admit I haven't fully thought through what this would look like in practice. I'd love a world where I can specify in my toml file something like:

[ruff.deprecated]
rule1 = { function="my.code.deprecated_function", message="This function is deprecated", replacement="some.other.function", safe=False}

Is something like this feasible?

(There's a more general question about a plugin interface -- our codebase is big enough that having custom lint rules is useful, but it's not OSS so upstreaming changes to ruff probably isn't worthwhile and forking ruff to add our own rules seems undesirable).

@AlexWaygood
Copy link
Member

Hi, thanks for the feature request! My instinct is that we should probably fold this into the broader discussion in #283, which discusses design principles for plugins/user-specific lints.

@MichaReiser
Copy link
Member

I do like the idea and I see generic rules as a first step towards a customizable Ruff that doesn't require plugin support.

This request is similar to #10131. Would Ruff's banned-api work for your use case?

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

No branches or pull requests

3 participants