Skip to content

PY-ENUM0002 · parallel_enum_metadata

Detect static string dictionaries that mirror one enum.

This is a deterministic rule for python. Read its implementation.

A parallel metadata dictionary has at least two entries, uses members of one locally defined enum as every key, and uses string literals as every value. The enum can own these descriptions directly and generate the dictionary when an API needs one.

Every finding identifies one parallel dictionary expression and its enum class.

Dynamic handler registries, non-string values, partial runtime overrides, and mappings across several enum types remain separate data structures.

{Intent.TODO: "Future work", Intent.WHY: "Rationale"} mirrors static enum descriptions. {Intent.TODO: handle_todo} remains a behavior registry.

  • Cites “Refactoring”, Parallel Inheritance Hierarchies