MetaCredo. Check. Warning. ImperativeStatusHandling
(MetaCredo v0.1.0)
View Source
Detects imperative if/else or case chains that branch on a status or
state field with 3+ distinct values. Ad-hoc status management is
error-prone (missing transitions, invalid state paths) and should be
replaced with a finite state machine (Finitomata, gen_statem, or
equivalent).
Also flags direct assignments to status fields and functions whose
names encode state-transition verbs (e.g. activate, suspend).
Category: Warning / Priority: normal
Configuration
Accepts the following parameters via .metacredo.exs:
status_field_names- Field/variable names to watch (default: ["status", "state"]) (default:["status", "state"])min_states- Minimum distinct status values before flagging (default: 3) (default:3)