Skip to content

Warn about error being related to a deprecated rule #18349

@Andrej730

Description

@Andrej730

Summary

My case - was trying out Ruff and enabled UP. Going through the log of found errors, I've found that UP038 from my point of view seems unreasonable, checking the documentation I've found that it's actually deprecated and will be removed soon.

A suggestion - ruff check to warn that found error is related to a deprecated rule, so it will be possible to find deprecated rules just by using ruff, without checking documentation. This would improve rule deprecation discoverability.

(I'm hope I'm not missing some option that already does that, but couldn't find anything related in https://docs.astral.sh/ruff/settings/)

a = 25
print(isinstance(25, (str, int)))
# ruff check L:\1_test.py --select UP --target-version py311
# UP038 Use `X | Y` in `isinstance` call instead of `(X, Y)`
#   |
# 2 | a = 25
# 3 | print(isinstance(25, (str, int)))
#   |       ^^^^^^^^^^^^^^^^^^^^^^^^^^ UP038
#   |
#   = help: Convert to `X | Y`
# 
# Found 1 error.
# No fixes available (1 hidden fix can be enabled with the `--unsafe-fixes` option).

Metadata

Metadata

Assignees

No one assigned

    Labels

    cliRelated to the command-line interfacehelp wantedContributions especially welcome

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions