Default value stated two ways
default-value-mismatchon by defaultJapanese / English
A parameter's default that differs between the signature, a table and the text
Example
How to fix
Check the real default, and correct the statement that differs.
Why it matters
When the signature says width = 72 and the text says "`width` defaults to 80", the reader misjudges what happens when the option is left out. It happens when a default changes and only the code, the table or the text is updated. The defaults in a declaration (width = 72), in a column headed Default, and after "`width` defaults to" are collected. When a name's value differs from its most authoritative statement (code, then a table, then a sentence), the differing one is pointed out.
What it does not flag
A value passed in a call (wrap(text, width=40)), a name not in code marks, a value away from the default phrase, and a disagreement only between statements of the same weight (two functions giving one parameter name different defaults) are not checked. A signature split over several lines, names with dashes (--max-width), tables whose rows do not start with |, and sentences with the value inside the phrase (`x` is true by default) are not read.
Turning it off or relaxing it
Technical details
- Layer
- L1
- Status
- stable
- Severity
- warning
- Languages
- Japanese and English
- Suited to
- technical, docs, blog, legal, academic, literature, speech
- Reads from the document
- markdown
Levels
Set a level for this rule under rules in chaff.yaml. With nothing set, it runs at the level its genre gives it (see By genre below).
| strict | error |
|---|---|
| normal | warning |
| relaxed | info |
This rule has no limit to count to. A level sets how a finding is marked: relaxed keeps the finding and marks it a step lower.
By genre
- Runs by default in
- technical/spec, technical/readme, blog/tech, blog/essay, blog/owned-media, docs/manual, docs/faq, docs/glossary
- Turned off by the genre in
- legal/contract, legal/statute, legal/judgment, legal/patent, academic/paper, literature/fiction, literature/essay, literature/poetry, literature/play, speech/address, speech/transcript
- Not suited to, and not run in
- business/proposal, business/report, business/email, business/press-release, business/meeting-notes
Message
The default of `{name}` is given as {value} here, but as {expected} elsewhere
This page is built from the rule's definition file:packages/chaff/rules/default-value-mismatch.yaml