Suppressing lint findings
When a finding is wrong for your code, silence it with an # arity-ignore
comment. Three forms are recognized.
# arity-ignore <rule>: <reason>
Suppresses one rule on the next non-trivia sibling — the next piece of code after the comment, whatever that is:
# arity-ignore unused-binding: part of the documented API
config <- list(width = 80)
The attachment skips blank lines and other comments, so the directive can sit above a block of documentation and still land on the code below it.
A trailing comment attaches the same way — to the code that follows it, not the code on its own line:
x <- 1 # arity-ignore browser: applies to the NEXT statement, not this one
browser()
# arity-ignore-file <rule>: <reason>
Suppresses one rule anywhere in the file. This is the right form for a generated or vendored file where a particular rule does not apply:
# arity-ignore-file unused-binding: generated by tools/codegen.R
# arity-ignore-file: <reason>
Suppresses every rule in the file, including every rule arity ships in the
future. It is rarely what you want; prefer the rule-scoped form above. The
blanket-suppression rule flags it.
Reasons
The text after the : is free-form and arity never interprets it — but a
suppression is a standing claim that the linter is wrong here, and that claim
outlives whoever wrote it. Recording why keeps the next reader from having to
guess whether it was considered or expedient.
unexplained-suppression enforces the
convention; it is off by default, so enable it with select if you want it.
Suppression is linted too
Suppression comments fail silently by nature: when one goes wrong, the symptom
is that nothing is reported, which is exactly what success looks like. Four
meta rules make those failures visible:
| Rule | Flags |
|---|---|
misnamed-suppression | a rule ID that does not exist |
blanket-suppression | a directive that names no rule |
unexplained-suppression | a directive with no reason (off by default) |
outdated-suppression | a directive that no longer silences anything |
Limits
- One rule per directive. There is no comma-separated list:
# arity-ignore a, breads the rule ID asa,and suppresses neither. Write a separate comment per rule.misnamed-suppressioncatches the mistake. - Syntax errors cannot be suppressed. A file that does not parse is reported
before any rule runs, so
# arity-ignore syntax-errorhas no effect (and is itself flagged as a misnamed rule). metafindings need the file-wide form. A finding about a directive is spanned on a comment, and a node-level# arity-ignoreattaches past comments to the next piece of code — so it can never land on the directive above it. Use# arity-ignore-file <meta-rule>: <reason>, or turn the rule off in configuration with[lint] ignore.- Roxygen lines are not directives.
#' arity-ignore …is documentation content, not a suppression.
Turning a rule off entirely
For a rule you never want, arity.toml is the better tool than a comment in
every file:
[lint]
ignore = ["unused-binding"]
See Configuration.