BannedPatternRule class
Copy the project has ruled out reaches a value. The patterns come from
the banned: block of dialect/glossary.yaml.
This is the mirror of the glossary rule: a glossary says always say
this,
banned: says never say that, and both are questions a reviewer asks
about wording, so they share a file. The motivating case is punctuation
policy — a project that has ruled out em-dashes in user-facing copy — but
nothing here is specific to that.
It runs on the source too. A banned pattern is a statement about what
ships, and the source locale ships. Scoping to translations would have
left the original English, which is the locale most such rules are
actually written about, unchecked. Per-entry locales: narrows it back
down when a rule really is about one language.
Severity is warning, and that is the whole design. A project that
wants this as a hard gate runs dialect check --strict, the same lever
that promotes every other heuristic; a project still cleaning up existing
copy gets a list rather than a wall.
Two exceptions, because copy policy has two.
dialect check --ack banned_pattern:LOCALE:KEY waives one use and expires
when that value is edited. except: on the pattern names keys ruled exempt
for good, which must survive a typo fix. The standing list is the one that
can rot, so this rule audits it: an except: key that no longer contains
the pattern is reported, and the list can only shrink.
Constructors
- BannedPatternRule()
-
const
Properties
- defaultSeverity → IssueSeverity
-
Default severity. May be overridden per-issue.
no setteroverride
- hashCode → int
-
The hash code for this object.
no setterinherited
- name → String
-
Stable rule identifier (snake_case). Used by the report formatter
to group findings and by users to silence/ack via state file
(post-v1.0).
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
run(
DialectProject project) → List< Issue> -
Inspect
projectand return findings. May return an empty list. Should NOT throw — turn unexpected conditions into Issues so the report surfaces them rather than crashing.override -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited