redline
LowDesignboolean-args

Boolean arguments

Boolean arguments. Bare booleans in a call (r(u, true, false). At the call site nobody can tell what they mean.

This is how the comment reads inline, under the flagged line.

Why it matters

render(user, true, false) hides intent and makes swapping two flags a silent bug.

What to do

Pass an options object or keyword arguments, or split into two functions.

Examples

Flagged
render(user, true, false);
Better
render(user, { compact: true, editable: false });

What it catches

It reads a pattern on each line, aware of strings and comments. Languages: TypeScript and JavaScript, Python. Scope: All files. These cases are the rule's own tests: the first set must be flagged and the second must not.

Flagged

render(u, true, false);
src/app.py
draw(x, True, False)

Left alone

render(u, { compact: true });

Research

Bare `true` or `false` arguments. The call site does not say what the flag means.

Turn it off or change it

In a config file for the CLI, or in the API's rules field:

{
  "rules": {
    "disable": [
      "boolean-args"
    ],
    "severity": {
      "boolean-args": "medium"
    }
  }
}

Read the source or report a false positive.