Nine Callers Five Flags
Three years ago someone noticed two invoice renderers looked alike and extracted a shared function. Today:
def format_invoice(order, *, tax=True, currency="USD", legacy_header=False,
itemize=False, redact_pii=False):
... # 180 lines, roughly 40 of them an if-tree over those five flags
It has nine callers. No two of them pass the same flag combination. A tenth caller now needs a variant whose header rules conflict with what legacy_header=True does.
What do you do?
Sign in to answer questions and track your progress
Sign In