no-enum-literal-comparison
Compare enum values using named members.
Why
Raw comparisons bypass the enum declaration. A typo or change to an enum member can silently leave a comparison or match arm out of sync.
Fix
Use named enum members in comparisons, membership checks, and match arms. Parse raw input at its boundary when it needs to participate in enum dispatch. When a raw field is compared with a member's .value, declare the field with the enum type and compare members.
Examples
from enum import StrEnum
class Action(StrEnum): BUILD = "build"
def is_build(action: Action) -> bool: return action == "build"from enum import StrEnum
class Action(StrEnum): BUILD = "build"
def is_build(action: Action) -> bool: return action == Action.BUILD