diff --git a/ci_kit/declared_literal.py b/ci_kit/declared_literal.py index 458a59c..9e7207b 100644 --- a/ci_kit/declared_literal.py +++ b/ci_kit/declared_literal.py @@ -9,10 +9,16 @@ THE POLICY IS THE CALLER'S. The kit ships no pattern, no declared file and no message. A rule is opened by `--rule LABEL`; the `--pattern` (Python `re`, repeatable, OR'd), `--example TEXT` -(repeatable, REQUIRED), `--declared PATH` (repo-relative, repeatable) and `--message TEXT` flags -after it belong to it. Flags before any `--rule` belong to one implicit rule. `--exempt-suffix +(repeatable, REQUIRED), `--declared PATH` (repo-relative, repeatable), `--exempt-prefix DIR/` +(repeatable) and `--message TEXT` flags after it belong to it. Flags before any `--rule` belong to one implicit rule. `--exempt-suffix .EXT` (every rule) exempts a file kind from findings, e.g. `.md` when prose may name the value. +AN EXEMPT PREFIX EXPIRES ITSELF. `--exempt-prefix DIR/` (one rule, a directory ending `/`) excuses +that rule's matches under DIR -- a tree imported whole that will be repointed later, say. It is +debt, so it must be able to end: the files under it are still READ, every excused line is counted +and named in the summary, and a prefix that holds no tracked file (a wrong path) or no live match +any more (the debt is paid) is exit 2 until the flag is deleted. It never excuses another rule. + A RULE MUST PROVE IT CAN FIRE. A pattern that cannot match the value it guards (a stray trailing space, a doubled backslash) would scan the tree and report clean forever. So: every `--example` must be flagged as a live line by the rule, and every `--pattern` must match at least one example; @@ -83,7 +89,7 @@ POWERSHELL_SUFFIXES = frozenset({".ps1", ".psm1", ".psd1"}) DEFAULT_MESSAGE = "Read the value from the declared source instead; a comment line may keep it for history." VALUE_FLAGS = frozenset({"--root", "--rule", "--pattern", "--example", "--declared", "--message", - "--exempt-suffix", "--comment-prefix"}) + "--exempt-suffix", "--comment-prefix", "--exempt-prefix"}) #: The openers the predecessor honoured in EVERY file. Each family below is a subset of it. OLD_OPENERS = ("#", "//", "