All rules

Example calls a function the page does not define

undefined-function-callon by defaultJapanese / English

An example calling a name the page never defines, close to one it documents

Example

Flagged
## wrap Wraps text to a given width. ```js const lines = wrapText("A long sentence to wrap.", 10); ```
What chaff prints
6:15 `wrapText` is called, but this page documents `wrap`
Fixed
## wrap Wraps text to a given width. ```js const lines = wrap("A long sentence to wrap.", 10); ```
What chaff prints
no finding
chaff.yaml used for this example
genre: technical/readme

How to fix

Call the function the page documents. If it is another function, document it on the page.

Why it matters

When an API reference or a README documents wrap and its example calls wrapText(...), the reader who copies the example stops at "not defined". It happens when a function is renamed and an example keeps the old name, or when the name is mistyped. The first word of a heading (## wrap) and the names an example imports are read as the functions the page documents. A call in a code block to a longer name that starts with one of them, written nowhere else on the page, is pointed out.

What it does not flag

A declaration (function wrapText(), a commented-out call, a function the programming language provides (parseInt, lexicon code-global), a name written anywhere else on the page (defined in the example, called twice, or named in the text), a member call (console.log(, obj.wrapText(), a name that does not start with a documented one, and documented names shorter than four characters are not checked.

Turning it off or relaxing it

Silence this one spot (in the document)
<!-- stet: undefined-function-call — reason -->
Relax it for the team (the reason is kept as a comment in chaff.yaml)
npx chaffjs relax undefined-function-call --why "reason"
Turn it off for the team (chaff.yaml)
rules: undefined-function-call: off
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).

stricterror
normalwarning
relaxedinfo

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

Genres

Message

`{name}` is called, but this page documents `{documented}`

This page is built from the rule's definition file:packages/chaff/rules/undefined-function-call.yaml