Back to Ruff

Invalid Match Pattern

crates/ty_python_semantic/resources/lint_docs/invalid-match-pattern.md

0.15.18279 B
Original Source

What it does

Checks for invalid match patterns.

Why is this bad?

Matching on invalid patterns will lead to a runtime error.

Examples

python
NotAClass = 42

match object():
    # TypeError at runtime: must be a class
    case NotAClass():  # error
        ...