prefer-match-value-dispatch
Prefer match/case for repeated dispatch on one value with a fallback.
Why
A single dispatch subject makes distinct value cases and their fallback easier to review.
Fix
Consider match/case while preserving fallback and constant semantics; use literal or dotted value patterns, never bare constant names that capture instead of compare. Review membership versus equality, subject evaluation, and guard order before rewriting.
Examples
def parse(kind): if kind == "json": return json_parser() elif kind == "yaml": return yaml_parser() else: return fallback()[project]requires-python = ">=3.10"def migrate(path): match path.name: case "eslint.json": return rewrite_eslint(path) case "ratchet.json": return rewrite_ratchet(path) case _: return rewrite(path)