Changelog ​

0.30.0 (2026-11-10) ​

Features ​

Bug Fixes ​

Dependencies ​

0.29.0 (2026-10-30) ​

Features ​

Bug Fixes ​

0.28.0 (2026-10-27) ​

Arity now has rudimentary support for .Rd files. It parses them but does not yet supply and language server features, linting, or formatting. It does, however, attach the server to .Rd files so that workspace symbols and diagnostics are available.

Features ​

Bug Fixes ​

Dependencies ​

0.27.0 (2026-10-25) ​

Features ​

Bug Fixes ​

Dependencies ​

0.26.0 (2026-10-13) ​

Features ​

Bug Fixes ​

Dependencies ​

0.25.0 (2026-10-05) ​

Features ​

Bug Fixes ​

Performance Improvements ​

Dependencies ​

0.24.0 (2026-09-25) ​

Features ​

Bug Fixes ​

Performance Improvements ​

0.23.0 (2026-09-07) ​

Features ​

Bug Fixes ​

Dependencies ​

0.22.0 (2026-08-31) ​

Features ​

Bug Fixes ​

Dependencies ​

0.21.0 (2026-08-26) ​

Features ​

Bug Fixes ​

Performance Improvements ​

Dependencies ​

0.20.0 (2026-08-21) ​

Features ​

Bug Fixes ​

Performance Improvements ​

Dependencies ​

0.19.1 (2026-08-17) ​

Bug Fixes ​

Performance Improvements ​

Dependencies ​

0.19.0 (2026-08-14) ​

The most prominent feature of this release is that Arity now handles the DESCRIPTION file in R projects: it lints it, formats it, and provides language-server features like inlay hints for loaded versions.

Breaking changes ​

Features ​

Bug Fixes ​

Performance Improvements ​

Dependencies ​

0.18.0 (2026-08-11) ​

Features ​

Bug Fixes ​

Performance Improvements ​

Dependencies ​

0.17.0 (2026-08-07) ​

Features ​

Bug Fixes ​

Dependencies ​

0.16.0 (2026-08-06) ​

Features ​

Bug Fixes ​

Dependencies ​

0.15.0 (2026-08-05) ​

Features ​

Bug Fixes ​

0.14.0 (2026-07-30) ​

Features ​

Bug Fixes ​

0.13.0 (2026-07-20) ​

Features ​

0.12.0 (2026-07-11) ​

Features ​

Bug Fixes ​

Performance Improvements ​

0.11.0 (2026-07-08) ​

Features ​

Bug Fixes ​

0.10.0 (2026-07-05) ​

Features ​

Bug Fixes ​

0.9.0 (2026-07-04) ​

Features ​

0.8.0 (2026-07-02) ​

Features ​

Bug Fixes ​

0.7.0 (2026-06-24) ​

Features ​

Bug Fixes ​

0.6.0 (2026-06-22) ​

Features ​

Bug Fixes ​

0.5.0 (2026-06-18) ​

Features ​

Bug Fixes ​

Performance Improvements ​

0.4.0 (2026-06-12) ​

Features ​

0.3.0 (2026-06-12) ​

Features ​

0.2.0 (2026-06-12) ​

Breaking changes ​

Features ​

Bug Fixes ​

Performance Improvements ​


Contributing to Arity ​

Thanks for your interest in improving Arity, a language server, formatter, and linter for R. This guide covers how to set up a development environment, the quality bar for changes, and the conventions we follow.

For a deeper tour of the architecture and the design tenets, read AGENTS.md; TODO.md is the live roadmap and records known issues and follow-ups.

Getting started ​

Arity is a Cargo workspace (edition 2024): the root arity package is the CLI, language server, and linter, and it builds on two independently published member crates, crates/arity-parser (lossless CST parser, AST wrappers, incremental reparser) and crates/arity-formatter (the formatting engine). The MSRV is declared as rust-version in Cargo.toml. rust-toolchain.toml selects the stable channel, so rustup picks up a suitable toolchain automatically.

The recommended setup uses devenv/Nix, which provisions the toolchain, R (with roxygen2, commonmark, styler), and every auxiliary tool (go-task, node, cargo-insta, cargo-audit, cargo-deny, air-formatter, jarl, hyperfine, and more):

sh
devenv shell

It also installs git hooks that run clippy, rustfmt, and biome on commit.

If you'd rather not use Nix, install a recent stable Rust toolchain and, for the R-dependent tasks (the roxygen oracles that regenerate pins, corpus checks), a working R with roxygen2 and commonmark. The core build, tests, and lint gates need only Rust.

Building and running ​

sh
cargo build                    # dev build
cargo build --release

cargo run -- format <file.R>   # format to stdout (stdin if omitted)
cargo run -- lint <path>       # lint; exits 1 on findings
cargo run -- lint --fix <path> # apply safe autofixes in place
cargo run -- parse <file.R>    # print the CST
cargo run -- index             # build the installed-package introspection index
cargo run -- lsp               # start the stdio language server

Every command reads an arity.toml found by walking up from the target path (--config forces one, --no-config ignores it). The repo's own arity.toml documents the defaults.

Repository layout &ZeroWidthSpace;

The root crate lives in src/ with its integration tests in tests/; the parser and formatter live in crates/arity-parser and crates/arity-formatter with their own tests/ (see AGENTS.md for the module tour). The repo also carries the distribution and documentation surfaces: editors/code (VS Code extension), npm/ and pyproject.toml (npm and PyPI wrappers around the binary), docs/ (the VitePress site), benches/ plus scripts/bench.sh, and scripts/ (the R helpers that regenerate the bundled base-R and CRAN symbol lists).

Quality gates &ZeroWidthSpace;

Treat CI (.github/workflows/) as the source of truth. Before opening a pull request, make sure the following all pass locally:

sh
cargo test --workspace                       # all tests (bare `cargo test` skips the member crates!)
cargo clippy --workspace --all-targets --all-features -- -D warnings   # warnings are errors
cargo fmt --all -- --check                   # keep changes rustfmt-clean

Markdown prose is formatted by panache, which CI checks; panache.toml excludes the generated and non-prose files.

JavaScript and TypeScript are linted and formatted by biome, on both a devenv git hook and a CI job. biome.jsonc scopes it to the repo's first-party sources --- editors/code/src and npm --- and documents what is deliberately left out.

The Taskfile.yml wraps these and more: task test, task lint, task format, task audit, task deny. Run task --list to see everything, including the heavier #[ignore]d suites: task air-compat, task corpus (needs ARITY_CORPUS=<dir>), task bench, and the roxygen-* oracle tasks.

Dependency changes must stay compatible with cargo-audit and cargo-deny (see deny.toml).

Test-driven development &ZeroWidthSpace;

Write the test first, watch it fail, then make it pass. For a bug, start by adding a failing test that reproduces it (a new fixture case or snapshot) before touching the fix.

Your first change &ZeroWidthSpace;

The loop differs a little per subsystem. Pick the one your change lands in.

A formatter bug (output is wrong, ugly, or unstable):

sh
cd crates/arity-formatter
mkdir tests/fixtures/formatter/my_case
$EDITOR tests/fixtures/formatter/my_case/input.R      # the offending code
$EDITOR tests/fixtures/formatter/my_case/expected.R   # what it should become
$EDITOR tests/formatter.rs                            # add "my_case" to fixture_names()
cargo test -p arity-formatter --test formatter        # watch it fail, then fix

The fix belongs in crates/arity-formatter/src/formatter/rules/ (the IR built per construct) or crates/arity-formatter/src/formatter/printer.rs (how the layout engine breaks lines) --- never a special case for one construct, and never a parser workaround (Tenets 1 and 3). The suite also asserts idempotence and losslessness, so a fix that formats your case correctly but destabilizes another will fail loudly.

A parser bug (wrong tree shape, a lost byte, a bad diagnostic):

sh
cd crates/arity-parser
mkdir tests/fixtures/parser/my_case
$EDITOR tests/fixtures/parser/my_case/input.R
$EDITOR tests/parser_snapshots.rs                     # add "my_case" to fixture_names()
cargo test -p arity-parser --test parser_snapshots    # the snapshot starts out missing
cargo insta review                                    # inspect the CST, accept if right

The CST is snapshotted and losslessness asserted automatically. If the tree shape is wrong, fix crates/arity-parser/src/parser/ and re-review the snapshot --- do not accept a snapshot you have not read.

A lint rule (new rule, false positive, bad autofix): rules live in src/linter/rules/<category>/<id>.rs, tests are plain #[test] functions in tests/lint.rs, and the per-rule documentation page is generated from the rule's own examples(). See Adding a lint rule below.

Anything cross-file (LSP, incremental, project graph): tests/lsp.rs and tests/lsp_protocol.rs cover the server, tests/salsa_incremental.rs guards that a function-body edit does not invalidate the project graph, and tests/incremental_reparse.rs covers the reparse strategies. These invariants are easy to break by accident: if you touch what a per-file salsa query returns, run cargo test --test salsa_incremental.

Configuration &ZeroWidthSpace;

Arity reads an arity.toml, discovered by walking up from the target path. arity init writes a starter file, and the repo's own arity.toml dogfoods discovery while documenting the defaults. The schema lives in src/config.rs and is rendered at arity.cc:

Two conventions worth knowing when extending the schema. The structs are #[serde(deny_unknown_fields, rename_all = "kebab-case")], so a typo in a user's config is an error rather than a silent no-op, and TOML keys are kebab-case even though the Rust fields are snake_case. And not everything belongs in the file: index.remote_url is deliberately #[serde(skip)] and read from the ARITY_REMOTE_URL environment variable instead, because enabling network egress is a per-user consent decision, not a committed project setting.

A rule that needs options of its own gets a [lint.rules.<id>] table, typed as its own struct and added as a field on RulesConfig. That keeps the unknown-field check working, at the price of one asymmetry worth knowing: a rule ID in select/ignore is data and so an unknown one is reported when linting runs, whereas a rule ID under [lint.rules] is schema and an unknown one fails at parse time. Rules read their table off RuleContext::config.

The published arity.toml JSON Schema is generated from these Rust types. After changing a configuration key, type, enum, constraint, or default, regenerate arity.schema.json with UPDATE_EXPECTED=1 cargo test config_schema, review the diff, and rerun cargo test config_schema. Do not edit the JSON by hand.

The stdin contract &ZeroWidthSpace;

- as the only path makes format, lint, and parse read one buffer from stdin. Editors, pre-commit hooks, and embedding consoles integrate through it, so parts of its shape are API rather than implementation detail:

Changing any of these is a breaking change and belongs in a ! commit; a caller cannot detect it, since --version is usually all it checks.

Design tenets to keep in mind &ZeroWidthSpace;

These are the load-bearing invariants; see AGENTS.md for the full statements.

  1. Deterministic, rule-based formatting. Layout is decided solely by the formatter's rules and layout engine. Arity does not honor persistent line breaks; the input's existing line breaks never influence the result. Avoid hard-coding special cases for specific constructs.
  2. Incremental parsing is first-class. Keep the salsa-based incremental reparse path (src/incremental.rs) viable.
  3. Parsing is the parser's job. Don't paper over parser mistakes in the formatter, and don't let parsing logic creep into the formatter.
  4. Losslessness is the parser's job. The parser preserves all text, so reconstruct(text) == text always. Formatter output must additionally be idempotent: format(format(x)) == format(x).

We also track a soft, one-directional compatibility target with the air formatter as a differential oracle. It is never a quality gate and is strictly subordinate to Tenet 1. Deliberate divergences are recorded in crates/arity-formatter/tests/air_compat_allowlist.toml with a rationale.

Reference checkouts &ZeroWidthSpace;

A few directories are referred to by tooling and documentation but are deliberately untracked, so a fresh clone does not have them. Nothing in cargo build or cargo test needs them; you only need a given one if you are running the corresponding oracle or reading the reference. Clone them into the repo root:

sh
# posit-dev/air: the R formatter arity is measured against. Read-only
# reference; it has its own conventions in air/CLAUDE.md that do NOT apply here.
git clone https://github.com/posit-dev/air

# The tidyverse style guide: the formatter's target style.
git clone https://github.com/tidyverse/style

# r-lib/roxygen2: the reference implementation behind the roxygen oracles.
# Pin the version recorded in tests/oracle/.roxygen2-source.
git clone --branch "v$(cat tests/oracle/.roxygen2-source)" \
  https://github.com/r-lib/roxygen2 roxygen2-ref

scripts/harvest-roxygen-corpus.R reads roxygen2-ref/; the air comparison in crates/arity-formatter/tests/air_compat.rs needs the air binary on PATH (devenv provides it), not the checkout.

Adding a lint rule &ZeroWidthSpace;

The linter ships 47 rules across six categories (correctness, suspicious, readability, performance, documentation, meta) with generated per-rule docs. A rule is a module under src/linter/rules/<category>/<id>.rs implementing the Rule trait --- it either subscribes to SyntaxKinds via interests and gets called during the one shared CST walk, or leaves interests empty and overrides check_file for a whole-file pass. Adding one touches the registry (all_rules in src/linter/rules.rs, the single source of truth), TDD fixtures, an autofix-correctness (parse-clean) case, and the snapshot-pinned generated docs. If you use Claude Code, the add-lint-rule skill walks through the whole sequence.

Note the autofix-correctness bar: a fix is a textual edit that must leave code that still parses and stays lossless; it does not owe line-width (the formatter re-lays-out afterward). When an edit can't be made correct by construction for some shape, withhold the fix for that shape rather than risk broken output.

Documentation &ZeroWidthSpace;

The docs site (docs/) uses VitePress and Cloudflare Workers Static Assets. Use sentence case for titles and headings, preserving proper names, acronyms, and code identifiers. Some reference pages are generated: build.rs writes the CLI reference from the clap definitions, and cargo run --example docgen renders the per-rule pages (by running the real linter on each rule's examples), the version stamp, and the benchmark partials. Regenerate with task docs-gen and preview with task docs-preview. Don't hand-edit generated pages --- the rendered rule docs are pinned by tests/rule_docs.rs and the benchmark partials by tests/benchmarks_docs.rs, so they can't drift from behavior.

Run compute run -- task docs-check to check the built site and local Worker. Use task docs-worker for a Worker preview. See docs/README.md for deployment and URL compatibility details.

Performance &ZeroWidthSpace;

Speed is a feature here, and it is measured rather than asserted.

The benchmark is a visibility tool, not a quality gate. It measures wall-clock speed only, never output equivalence (that is what task air-compat is for), and the tools do genuinely different work behind different startup floors --- read the ratios, not the milliseconds. A PR is never blocked on it.

Editor extension and packaging &ZeroWidthSpace;

Beyond the crate, the repo builds several distribution artifacts. You only need these if your change touches them.

Commits and pull requests &ZeroWidthSpace;

Prefer atomic commits. Small fixes can go straight to main; branch first for anything substantial. Please make sure the quality gates above pass before you open the PR.

How a release happens &ZeroWidthSpace;

Releases are automated, which is why commit messages matter: your Conventional Commit type is what decides the next version number.

On every push to main, once the test, cargo-audit, and cargo-deny jobs go green, versionary (configured in versionary.jsonc) opens or updates a release PR that bumps the version, regenerates CHANGELOG.md, and propagates the version into npm/arity-cli/package.json (both its own version and every optionalDependencies entry). The member crates arity-parser and arity-formatter are versioned independently, routed by path: a commit touching crates/arity-parser bumps only that crate, and its releases are tagged arity-parser-v<version> (likewise arity-formatter-v<version>), while the CLI keeps the bare v<version> stream. The VS Code extension is another versioned package that follows the CLI. Merging the release PR tags the release, which then fans out: release binaries for all eight targets (with keyless provenance attestation), the VS Code and Open VSX extensions, and the crates.io (all workspace crates, in dependency order), npm, and PyPI publishes. Only the CLI's v* stream carries GitHub release assets.

Practical consequences:

Reporting issues &ZeroWidthSpace;

Bug reports and feature requests are welcome on the issue tracker. For a bug, a minimal R snippet that reproduces the problem is the most helpful thing you can include.

License &ZeroWidthSpace;

By contributing, you agree that your contributions are licensed under the project's MIT License.


Configuration ​

Put an arity.toml at the root of your project to share formatting and linting settings between the CLI and language server. Every key is optional. This guide covers common setup tasks; the configuration reference lists all keys, defaults, and resolution rules.

Create a project config ​

Run this in a project that does not yet have an arity.toml:

sh
arity init

The generated file contains commented settings. A small active configuration might look like this:

toml
extend-exclude = ["vendor/", "*.gen.R"]

[format]
line-width = 100

[lint]
ignore = ["unused-binding"]

Commit the file so contributors use the same settings. Keys use kebab-case; unknown keys are errors. Add #:schema https://arity.cc/arity.schema.json at the top for completion and validation in editors that support TOML schema directives. See editor support for other ways to associate the schema.

Choose the configuration source ​

For each input file, Arity uses the nearest arity.toml, searching upward to the repository root. When there is no project config, ARITY_CONFIG can point to a fallback file. Discovery selects one file; it does not automatically merge project and user settings.

To choose a file explicitly or try the built-in defaults:

sh
arity --config path/to/arity.toml format R/example.R
arity --no-config lint R/example.R

CLI options such as --line-width override the corresponding setting for one run. See discovery for fallback paths and language-server behavior.

Share settings between projects ​

Use extend when a project should inherit another file:

toml
extend = "../shared/arity.toml"

[format]
line-width = 100

The path is relative to the file declaring it. The project's values override inherited values. Tables merge by key, while extend-exclude adds patterns to the inherited exclusions.

Exclude files ​

Use extend-exclude to add gitignore-style patterns while retaining Arity's built-in exclusions:

toml
extend-exclude = ["vendor/", "generated/"]

These patterns apply to directory walks by both the formatter and linter. A file named explicitly is still processed; add --force-exclude when a runner passes filenames that should respect the exclusions:

sh
arity format --force-exclude generated/example.R

Set exclude only when you want to replace the default list. For a local exception within a source file, use directives.

Adjust formatting and linting ​

Use [format] for layout settings and [lint] for rule selection. Start with the formatting and linting guides, then consult the reference for formatting options and lint settings.

Use extend-select to enable opt-in rules while preserving the defaults:

toml
[lint]
extend-select = ["undesirable-function"]

If you also set select, Arity adds extend-select to that list instead. ignore takes precedence over both lists. When inheriting a config with extend, extend-select accumulates across the chain.

The dprint plugin has its own configuration in dprint.json; it does not load arity.toml.


Editor setup ​

Arity ships a language server, started with arity lsp (stdio, JSON-RPC). It offers formatting, diagnostics with quick fixes, hover, completion, signature help, go-to-definition and find-references, rename, document and workspace symbols, semantic tokens, folding and selection ranges, document links, document color swatches, inlay hints, and call and type hierarchy.

Document outlines include function signatures with parameter defaults and nested bindings. Editors without hierarchical outline support receive a flat list with each nested binding labeled by its enclosing binding.

Editors can also start the server for .Rd and .rd files, making workspace symbol search available before you open an R file. Arity does not yet provide diagnostics, formatting, or other document features for Rd files.

Beyond the quick fixes attached to lint diagnostics, the server offers a cursor-context refactor that writes a roxygen2 skeleton for the function you are on; see the code action reference.

Configuration is read from an arity.toml discovered from each file's directory or, if no project config is found, from the file named by ARITY_CONFIG (see the configuration reference). The server rechecks config files on subsequent formatting requests and document edits, including a user config outside the workspace. A missing or invalid ARITY_CONFIG file causes formatting to be refused until the config is fixed.

VS Code/Positron ​

Install the Arity extension from the VS Code Marketplace or Open VSX. It bundles the arity binary (falling back to a download) and starts the language server automatically for R and Rd files. Editors that support VS Code extensions, such as Positron, work the same way.

To use a custom user config, add this to your user settings.json, then run Arity: Restart Server:

json
{
  "arity.serverEnv": {
    "ARITY_CONFIG": "P:/Softwares/arity.toml"
  }
}

Use an absolute path. Project configs take precedence over this fallback.

Using only some features ​

The formatter, linter, and language features share one server but can be turned off independently, so you can adopt just the parts you want:

All three default to true. They are client-side gates, so the server keeps running and the toggles take effect without a restart or reinstall. For a formatter-only setup, turn off the other two:

json
{
  "arity.diagnostics.enable": false,
  "arity.languageFeatures.enable": false
}

Turning off arity.diagnostics.enable this way suppresses every diagnostic, including the syntax/parse errors that an arity.toml [lint] selection cannot silence. The arity.toml route stays the right tool when you want to keep parse errors but mute specific lint rules across every editor and the CLI.

Zed ​

Arity attaches to Zed's R language, which the R extension provides. Install that one first, then install Arity from the extensions view (zed: extensions in the command palette).

The Arity extension also recognizes .Rd and .rd files as Rd, so opening one starts the server for workspace symbol search.

Zed uses the arity on your PATH when there is one, and otherwise downloads the release binary matching your platform. Keeping Arity on the PATH is the better option on distributions that cannot run the generic release build, NixOS above all.

The R extension also ships r_language_server. Zed runs both servers unless you say otherwise, so name the ones you want and put Arity first when it should handle formatting, in settings.json:

json
{
  "languages": {
    "R": {
      "language_servers": ["arity-language-server", "r_language_server"],
      "formatter": "language_server",
      "format_on_save": "on"
    }
  }
}

To run Arity alone, drop "r_language_server" from the list.

Editor settings go under the server's id and act as fallbacks when the project has no arity.toml:

json
{
  "lsp": {
    "arity-language-server": {
      "settings": {
        "lineWidth": 100,
        "indentWidth": 2
      }
    }
  }
}

An arity.toml in the project is authoritative, so prefer the file when the whole team should share the behavior.

To point Zed at a particular binary, set binary.path:

json
{
  "lsp": {
    "arity-language-server": {
      "binary": { "path": "/opt/arity/bin/arity", "arguments": ["lsp"] }
    }
  }
}

arguments replaces the command line rather than extending it, so it has to keep naming a subcommand that speaks LSP.

The R extension recognizes files by .r or .R suffix. It does not assign its language to DESCRIPTION, so the Arity extension cannot attach to those files until Zed's R language definition covers them.

Neovim ​

Register arity with Neovim's built-in LSP client for R, DESCRIPTION, and Rd files:

lua
-- Neovim ships no filetype for DESCRIPTION, so give it one. The name is yours
-- to choose: arity routes on the file name, not on what the client calls it.
vim.filetype.add({ filename = { DESCRIPTION = "r-description" } })

vim.lsp.config("arity", {
  cmd = { "arity", "lsp" },
  filetypes = { "r", "r-description", "rhelp" },
  root_markers = { "arity.toml", "DESCRIPTION", ".git" },
})
vim.lsp.enable("arity")

The rhelp filetype starts Arity when you open an Rd file, making workspace symbol search available. Drop the vim.filetype.add line and keep only "r" in filetypes if you only want arity on .R files.

Format on save (optional):

lua
vim.api.nvim_create_autocmd("BufWritePre", {
  pattern = { "*.R", "DESCRIPTION" },
  callback = function() vim.lsp.buf.format() end,
})

The DESCRIPTION entry matters: without it, the file is attached to the server and linted but never formatted on save.

Helix ​

In ~/.config/helix/languages.toml:

toml
[language-server.arity]
command = "arity"
args = ["lsp"]

[[language]]
name = "r"
language-servers = ["arity"]
formatter = { command = "arity", args = ["format"] }
auto-format = true

To start Arity when you open an Rd file, add a separate language entry to the same file:

toml
[[language]]
name = "rd"
scope = "text.rd"
language-id = "rd"
file-types = ["Rd", "rd"]
roots = ["arity.toml", "DESCRIPTION", ".git"]
language-servers = ["arity"]

RStudio ​

The development R package provides a Format with arity addin and discovers arity.toml automatically. These features were added after the CRAN 0.1.0 release. Install the development version to use them; building from source requires Cargo and Rust 1.89 or newer:

r
install.packages("remotes")
remotes::install_github("jolars/arity-r")

Choose Format with arity from RStudio's Addins menu. It formats selected R code, or the whole document when nothing is selected, including unsaved edits and untitled R scripts. Changes remain in the editor for you to save. To assign a shortcut, open Tools > Modify Keyboard Shortcuts and search for the addin.

The addin discovers configuration from the document's directory, or the working directory for untitled buffers. It uses the nearest arity.toml, with ARITY_CONFIG as a fallback when no project config is found. Only formatting settings apply; file exclusions and lint configuration do not. See the R package documentation for configuration overrides and supported selections.

With the CRAN package, format saved files from the console:

r
arity::format_file("R/example.R")

This rewrites the file on disk. CRAN 0.1.0 takes formatting options as function arguments and does not discover arity.toml. The R package embeds the formatter, so neither installation needs the Arity CLI.

Other editors ​

Any LSP-capable editor can use arity by launching arity lsp over stdio for the r language. Point your client's R language-server command at arity with the lsp argument.

To get the DESCRIPTION features too, add the file to whatever the client uses to decide which documents to send. Arity decides the grammar from the file name, so the language id the client reports does not matter, and one that says r is still handled as DCF.

To start Arity from an Rd file, associate .Rd and .rd with the same server in your client's filetype or document selector settings. The rd language id also identifies pathless Rd buffers. This enables workspace symbol search without opening an R file first.

DESCRIPTION files ​

The server also serves a package's DESCRIPTION, which is a different grammar from R. There it offers the packaging diagnostics, completion of canonical field names and package names in Depends, Imports, Suggests, LinkingTo, and Enhances, and hover showing a dependency's installed version and title. Field names follow the formatter's order, omit fields already declared, and add : when starting a new header. An unsaved edit counts immediately, so adding a package to Imports clears the undeclared-dependency findings in the R files that use it without saving first.

The installed version is also shown inline, as an inlay hint after each dependency:

text
Imports:
    dplyr (>= 1.0.0) 1.1.4,
    rlang 1.1.4,

Only indexed packages get one, so a dependency you have not installed stays bare. Arity has no setting of its own for these — your editor's inlay hint switch (editor.inlayHints.enabled in VS Code) turns them off.

Diagnostics are reported only for a DESCRIPTION at a package root of its own, matching what arity lint walks. A complete miniature package under tests/testthat/ is fixture data for a test, so it stays quiet.

A DESCRIPTION is formatted too, by default, so format-on-save canonicalizes it the same way it canonicalizes your .R files. Set description = false under [format] in arity.toml to leave it alone.

Only whole-document formatting is offered: canonical field order is a property of the whole file, so editor.formatOnSaveMode: "modifications" (and format-selection generally) will not touch a DESCRIPTION.

Editors need to be told to send the file, since most do not recognize DESCRIPTION on their own. The VS Code extension does this for you; for the rest, see the sections below.


Formatting ​

Arity formats R source, roxygen comments, and package DESCRIPTION files. Start with installation, then run the formatter from your project directory.

Format files ​

Format one file in place, or pass a directory to format the files inside it:

sh
arity format R/example.R
arity format .

You can pass several files or directories in one invocation. Directory walks honor .gitignore and the exclusions in arity.toml. They include package-root DESCRIPTION files as well as R source. See Configuration to exclude generated or vendored files.

Check without writing ​

Use --check to report files that need formatting without changing them:

sh
arity format --check .

Arity prints a diff for each file that would change and exits nonzero if any need formatting. Add --quiet to show the file list and summary without the diffs. See Integrations to run this check in CI or pre-commit.

Format standard input ​

Pass - to read a buffer from standard input and write the formatted text to standard output:

sh
cat R/example.R | arity format -

Standard input is treated as R source unless you supply --stdin-filename. For a package description, use:

sh
cat DESCRIPTION | arity format --stdin-filename DESCRIPTION -

--check requires file paths. For an editor buffer, consume the formatted standard output instead. Editor setup covers the language server and RStudio integration.

Choose formatting settings ​

Put shared settings in arity.toml so the CLI and language server use the same style:

toml
[format]
line-width = 100
indent-width = 2

For a single run, use arity format --line-width 100 R/example.R. The configuration reference describes every setting, including line endings and the switches for roxygen and DESCRIPTION formatting. DESCRIPTION continuation lines use four spaces regardless of the R indentation setting.

Preserve selected layout ​

Use a formatter directive when a particular statement needs hand-written layout:

r
# arity-format skip: the rows show the matrix layout
m <- matrix(c(1, 0,
              0, 1), nrow = 2)

# arity-format off and # arity-format on protect a region, and # arity-format skip-file protects a whole file. These spellings leave linting enabled. See Directives for their scope and the special rules for DESCRIPTION files.

Formatting changes layout. To apply code rewrites as well, follow the linting guide and run the formatter after the fixes.


Getting started ​

Run Arity from the root of an existing R project. The commands below use the default settings unless your project already has an arity.toml.

Install Arity ​

Use the installer to download Arity for your platform:

sh
curl --proto '=https' --tlsv1.2 -sSf https://arity.cc/install | sh
powershell
powershell -NoProfile -ExecutionPolicy Bypass -Command "irm https://arity.cc/install.ps1 | iex"

See Installation for package managers and other options, or Editor setup to use Arity directly in your editor.

Check your project ​

Check formatting and report lint findings without changing files:

sh
arity format --check .
arity lint .

The formatter prints a diff for files that need formatting. The linter reports findings with file locations, rule names, and suggestions. Both commands exit with a nonzero status when they report problems, so they work as CI checks too.

Directory walks honor .gitignore and the project's configured exclusions. You can pass a file or subdirectory instead of . to narrow the scope.

Apply changes ​

Apply available safe fixes, then format the result:

sh
arity lint --fix .
arity format .

Some findings need manual changes. Review the diagnostics and the diff, then rerun the checks above.

See Linting for rule selection and suppressions, and Formatting for standard input and other options.

Share project settings ​

Arity works without configuration. To customize the defaults, generate an arity.toml in a project that does not already have one:

sh
arity init

Use it to choose rules, adjust formatting, and exclude generated files. The CLI and language server use the same project configuration. See Configuration for common settings and discovery rules.

Use Arity in your workflow ​

Follow Editor setup for formatting, diagnostics, and navigation while editing. See Integrations to run the checks in CI or a pre-commit hook.


Integrations ​

Use Arity in CI, Git hooks, and other formatting tools.

For editor and language-server setup, see Editor setup instead.

GitHub Actions ​

arity-action installs arity and runs the format and lint checks in CI. Create .github/workflows/arity.yml:

yaml
name: Arity

on:
  pull_request:
  push:
    branches: [main]

permissions:
  contents: read

jobs:
  arity:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - uses: jolars/arity-action@v1
        with:
          version: v0.25.0

By default this runs both arity format --check and arity lint over the whole repository without changing files. It checks R files and package-root DESCRIPTION files using the CLI's configuration discovery. Directory walks honor .gitignore and the exclusions in arity.toml. Formatting differences or lint findings fail the check.

The @v1 tag selects the action version; version selects the Arity CLI release. Keep the latter aligned with your local installation and pre-commit revision. Omitting it selects latest. Common inputs:

Input Default Description
path . File or directory to check
version latest Version to install (latest or vX.Y.Z)
format true Run arity format --check
lint true Run arity lint
config (none) Path to an arity.toml to use
verify-checksum true Verify the downloaded asset against its published hash

It also exposes the installed version as the version output. To run only one of the two checks, turn the other off:

yaml
- uses: jolars/arity-action@v1
  with:
    version: v0.25.0
    path: R
    lint: "false"

Set format: "false" to run only linting. See the action reference for the inputs and outputs supported by @v1.

pre-commit ​

arity-pre-commit provides pre-commit hooks. They install a prebuilt binary wheel from PyPI, so no separate Arity or Rust installation is needed.

Install pre-commit, then add this entry to .pre-commit-config.yaml:

yaml
repos:
  - repo: https://github.com/jolars/arity-pre-commit
    rev: v0.25.0
    hooks:
      - id: arity-lint
      - id: arity-format

Install the Git hook and run it once over all tracked files:

sh
pre-commit install
pre-commit run --all-files

On subsequent commits, arity-lint reports findings for staged .r and .R files. arity-format formats those files and staged DESCRIPTION files in place. The lint hook does not select DESCRIPTION files by default, although the CLI supports them. When a hook changes a file, review and stage the changes, then commit again.

To apply safe fixes, add --fix to the lint hook and keep it before formatting:

yaml
hooks:
  - id: arity-lint
    args: [--fix]
  - id: arity-format

To check formatting without changing files, add args: [--check] to arity-format.

Both hooks run with --force-exclude. pre-commit passes staged files as explicit arguments, and files named explicitly are normally always processed; the flag applies the exclude patterns from your arity.toml to them anyway, so a staged file you have excluded stays excluded. See Configuration for those patterns.

The rev selects the Arity release: v0.25.0 installs Arity 0.25.0. Run pre-commit autoupdate to update hook revisions, then review and commit the changes to .pre-commit-config.yaml.

dprint ​

Format R files alongside other languages with dprint and dprint-plugin-arity. The plugin bundles Arity's formatter as WebAssembly, so no Arity CLI or R installation is needed.

Install dprint. If your project has no dprint.json, create one with dprint init, then add Arity:

sh
dprint config add jolars/arity

Commit the versioned, checksummed plugin URL that the command adds to dprint.json. Run dprint fmt to format files in place or dprint check to check without changing files. The check fails when files need formatting. The plugin handles .r and .R files; it provides formatting rather than linting.

Configure it under the arity key:

Key Values Default
lineWidth integer dprint global, else 80
indentWidth integer dprint global, else 2
lineEnding auto, lf, crlf, native from global newLineKind
roxygen boolean true
roxygenMarkdown boolean false

These correspond to the formatting settings. Set roxygen to false to preserve roxygen comment layout while formatting the surrounding R code.

The plugin reads its configuration from dprint.json and does not load arity.toml. Use dprint's top-level includes and excludes for file selection; Arity's TOML exclusions do not apply. dprint also respects .gitignore. See dprint's configuration guide.

The Arity CLI discovers whether roxygen comments use Markdown by reading the package's DESCRIPTION and man/roxygen/meta.R. The plugin cannot read those files. So a package whose DESCRIPTION sets Roxygen: list(markdown = TRUE) needs roxygenMarkdown set explicitly:

json
{
  "arity": { "roxygenMarkdown": true }
}

Per-block @md and @noMd tags still take precedence over that default, exactly as they do in the CLI.

The plugin is released independently of the CLI. Run dprint config update, then review and commit the configuration changes. Matching CLI output requires the same arity-formatter version, equivalent settings, and an explicit roxygenMarkdown setting when the CLI derives it from package files.

Using with Panache ​

Panache can format and lint R code blocks inside Markdown, Quarto, and R Markdown documents. Install both CLIs on your PATH, then add this to the document project's panache.toml:

toml
[formatters]
r = "arity"

[linters]
r = "arity"

Run panache format document.qmd to format the document and its R blocks, or panache lint document.qmd to report findings without changing files. The linter also runs through Panache's language server. To apply safe fixes before formatting, run panache lint --fix document.qmd, then format the document.

Panache's Arity linter preset passes --no-config, so it does not load arity.toml and uses Arity's default lint configuration. The formatter preset runs separately and retains its CLI configuration behavior. See Panache's formatter preset, linter preset, and external-tool configuration.

mise-en-place ​

Use mise or Aqua to install and pin the Arity CLI for a project.


Linting ​

Arity reports problems in R source and package metadata. It checks code without running R. Install Arity, then run the linter from your project directory.

Check files ​

Check one file or a whole project:

sh
arity lint R/example.R
arity lint .

Directory walks include R files and package-root DESCRIPTION files, honoring .gitignore and configured exclusions. Explicitly named files are processed even if excluded unless you add --force-exclude. See Configuration.

The linter reports findings with source locations and rule IDs. It exits with status 0 when there are no findings, 1 for findings or parse diagnostics, and 2 for usage or I/O errors. A file with parse errors must be repaired before its lint rules can run.

To lint a buffer from standard input, use:

sh
cat R/example.R | arity lint --stdin-filename R/example.R -

For compact output or a JSON array of diagnostics:

sh
arity lint --output concise .
arity lint --output json .

Choose rules ​

The Lint rules reference explains each rule and its default behavior. To check a particular rule for one run:

sh
arity lint --select equals-na .

To disable a rule for the project, put it in arity.toml:

toml
[lint]
ignore = ["unused-binding"]

To enable an opt-in rule while keeping the defaults, use extend-select:

toml
[lint]
extend-select = ["undesirable-function"]

For one run, use arity lint --extend-select undesirable-function ..

Apply fixes ​

Apply safe fixes in place, then format the rewritten code:

sh
arity lint --fix .
arity format .

The linter reports findings that remain after fixing. Some findings need manual changes, so review that output even when files were updated. Fixes change source code; the formatter handles its layout in the second command.

To include fixes that may change behavior, explicitly opt in with arity lint --fix --unsafe-fixes . and review the resulting diff. The rule reference describes the available fixes.

Suppress a finding ​

When a rule is inappropriate at one site, put a directive before that statement:

r
# arity-lint skip browser: interactive debugging entry point
browser()

Prefer a named rule and a reason. For a whole file, use # arity-lint skip-file <rule>: <reason>. Region directives, package metadata, and the rules that check suppression comments are covered in Directives. Parse errors cannot be suppressed.

Use Editor setup for diagnostics and fixes while editing, or Integrations to run lint checks in CI and pre-commit.


Performance ​

Arity is measured against other R tools in two suites: command-line speed, measured with hyperfine, and language-server latency and memory, measured through LSP over stdio or TCP. The command-line suite covers two operations:

Each operation is measured at two scopes: single files (the largest source file of each benchmarked package, plus two synthetic corpus tiers) and whole projects (real R packages). arity is the baseline in every chart, and every other tool's time is reported relative to it.

The tools also pay very different startup floors: styler and lintr run inside an R process, so a large part of their time on small inputs is interpreter startup rather than real work. Treat the ratios, not the absolute milliseconds, as the takeaway.

The figures below come from the committed machine-readable artifact benches/benchmark_results.json. Run task bench to refresh command-line measurements or task bench-lsp to refresh language-server measurements, then task docs-gen to update this page. Each suite preserves the other's results. Neither suite runs when the site is built or in CI.

How it is measured ​

For single files, each tool is invoked as a user would pipe (formatters) or point it at a file (linters):

Tool Invocation
arity arity format / arity lint FILE
air air format --stdin-file-path bench.R
styler Rscript -e 'styler::style_text(readLines(file("stdin")))'
jarl jarl check FILE
lintr Rscript -e 'lintr::lint(FILE)'

For projects, each tool walks the package's R/ source tree in one invocation. Formatters run in check mode so nothing is mutated, but the full formatting work is still done:

Tool Invocation
arity arity format --check R/ / arity lint R/
air air format --check R/
jarl jarl check R/
lintr Rscript -e 'lintr::lint_dir("R/")'

arity is the baseline; every other tool's time is reported relative to it. Comparison tools absent from the machine are skipped, so a run without jarl simply omits it from the linter charts. The timing backend prefers hyperfine (warmup plus stddev/min/max); without hyperfine and jq it falls back to a mean-only shell loop and the min/max columns become blank.

The R-backed tools need two caveats. styler and lintr pay an interpreter startup floor plus a steep per-line cost, so they are skipped on documents above 20,000 lines to keep a run tractable; styler is additionally absent from the project charts, because style_dir would rewrite the checkout and it has no check-only directory mode. styler's persistent on-disk cache of already-styled expressions is deactivated for the measurement, so that every run does the full work rather than inheriting whatever an earlier run happened to style. Because the tools do such different work, this is a rough scale comparison, not a like-for-like one. Set ARITY_BENCH_NO_R=1 to leave both out of a run.

Corpus ​

Single files mix real and synthetic input. The real documents are the largest source file of each benchmarked package, which is the closest stand-in for the per-file work an editor asks of a formatter or linter. The synthetic tiers are built by concatenating every formatter fixture's expected.R (crates/arity-formatter/tests/fixtures/formatter/*/expected.R, sorted, blank-line separated) into a base block and repeating it to two sizes. That content repeats, so it is cache-friendly and not representative of real code; it exists to amortize process startup and show rough scaling.

Projects use real R packages: the tidyr and MASS source trees, cloned once at pinned tags into a local cache. The two are deliberately unalike---tidyr is modern tidyverse code, MASS is long-lived base-R-style code. Point the benchmark at your own checkout with ARITY_BENCH_PROJECT=/path/to/pkg task bench, which replaces the list entirely; only a package's R/ directory is measured.

Setup ​

Results ​

Each operation gets its own section below, split into single files and whole projects. The arity baseline sits on the dashed line at 1 in every chart; faster tools fall below it, slower tools rise above.

Formatter ​

Single files ​

Formatting speed on single files relative to arity, one dot per document: the largest source file of each benchmarked package, then two synthetic corpus tiers. The vertical axis is mean wall-clock time as a ratio to arity on a log scale, so arity lies on the dashed baseline at 1; faster tools fall below it and slower tools rise above. Hover a dot for the exact figures.
Data table
MASS/polr.R (19787 bytes, 534 lines)
ToolMean (ms)Min (ms)Max (ms)Relative
arity4.84153.62819.1041baseline
air8.20437.072712.01331.7x slower
styler3164.68023060.08183299.2111653.7x slower
tidyr/pivot-wide.R (23349 bytes, 807 lines)
ToolMean (ms)Min (ms)Max (ms)Relative
arity4.45973.202510.6042baseline
air5.61264.52399.85781.3x slower
styler1737.51101718.20321771.2710389.6x slower
small (147122 bytes, 9896 lines)
ToolMean (ms)Min (ms)Max (ms)Relative
arity6.29784.816114.9822baseline
air29.888926.546334.67164.7x slower
styler13353.891213063.731413676.71442120.4x slower
large (1765464 bytes, 118752 lines)
ToolMean (ms)Min (ms)Max (ms)Relative
arity45.016536.5220107.3092baseline
air332.7182325.1847337.47787.4x slower

Projects ​

Formatting speed on real R packages (the tidyr and MASS source trees) relative to arity, on the same log-ratio axis.
Data table
tidyr (245685 bytes, 8774 lines)
ToolMean (ms)Min (ms)Max (ms)Relative
arity23.720920.951237.4993baseline
air36.142233.752939.35431.5x slower
MASS (214820 bytes, 5951 lines)
ToolMean (ms)Min (ms)Max (ms)Relative
arity33.360831.145442.0423baseline
air63.301959.795067.52711.9x slower

Linter ​

Single files ​

Linting speed on single files relative to arity, one dot per document, on the same log-ratio axis as the formatter charts.
Data table
MASS/polr.R (19787 bytes, 534 lines)
ToolMean (ms)Min (ms)Max (ms)Relative
arity33.161529.736839.1127baseline
jarl12.962811.909616.14382.6x faster
lintr1065.32561058.96721069.063432.1x slower
tidyr/pivot-wide.R (23349 bytes, 807 lines)
ToolMean (ms)Min (ms)Max (ms)Relative
arity30.870927.858741.4557baseline
jarl10.62349.550314.39222.9x faster
lintr902.9177893.4831914.306729.2x slower
small (147122 bytes, 9896 lines)
ToolMean (ms)Min (ms)Max (ms)Relative
arity30.150928.300433.7130baseline
jarl31.111128.950034.17001.0x slower
lintr13989.442911809.655315178.5032464.0x slower
large (1765464 bytes, 118752 lines)
ToolMean (ms)Min (ms)Max (ms)Relative
arity728.6282572.06151020.3157baseline
jarl492.3987471.9990547.08191.5x faster

Projects ​

Linting speed on real R packages (the tidyr and MASS source trees) relative to arity, on the same log-ratio axis.
Data table
tidyr (245685 bytes, 8774 lines)
ToolMean (ms)Min (ms)Max (ms)Relative
arity32.130528.564737.8632baseline
jarl13.822612.232619.12932.3x faster
lintr9238.45689186.38269305.5851287.5x slower
MASS (214820 bytes, 5951 lines)
ToolMean (ms)Min (ms)Max (ms)Relative
arity35.867330.994040.1854baseline
jarl20.561016.728428.77411.7x faster
lintr9519.12749438.22529598.3566265.4x slower

Language-server latency and memory ​

This Linux-only suite compares Arity with languageserver and, when installed, Ark. It follows Panache's LSP benchmark. It starts three fresh processes per server in rotating order, opens the five largest tracked R files in tidyr v1.3.2 at a pinned commit, and performs 1,000 edits in the largest file. The checkout stays unchanged: benchmark bindings and edits exist only in the open buffer.

What the session measures ​

Startup and workload covers process launch through the initialize response, workspace readiness after initialization, readiness after opening the files, and the complete edit workload. Arity and languageserver must publish diagnostics for the opened files before warm requests begin. Ark suppresses initially empty and unchanged diagnostic sets, so diagnostic notifications cannot establish its readiness. All servers must answer document-symbol requests for each opened buffer, followed by a quiet period. Readiness is estimated from process-tree CPU use: the start of a five-second window below 5% of one core, sampled every 150 ms. The deliberate settling wait is excluded from readiness times. These estimates do not prove that all background work has finished or that Ark has completed diagnostics for the latest version. The artifact records each server's readiness method.

Ark starts as a headless Jupyter R kernel. Its startup measurement includes the kernel handshake and opening the embedded language server over loopback TCP. Positron is not required. Arity and languageserver use stdio. The TCP client uses TCP_NODELAY and Linux TCP_QUICKACK to avoid delayed acknowledgments stalling responses whose headers and bodies arrive separately. Each server's transport is recorded in the artifact.

Request latency covers document symbols in the three largest open files, hover on mean(), and definition, references, and rename on a local function call appended to the largest buffer. Rename edits are returned but never applied. Each target gets two warmups and 20 measured serial round trips per process. Median and p95 pool samples across processes; the tables and tooltips also report sample counts, empty responses, returned items, and result sizes. An empty response measures response overhead and does not establish equivalent feature behavior.

Document-symbol samples query unchanged buffers after readiness checks and warmups, so they include any per-document caches. They do not measure the first outline after an edit.

The outlines also differ in scope. On this corpus, Arity includes many local assignments absent from Ark's results. Larger outlines cost more to serialize and transfer, so compare returned-item counts and payload sizes alongside latency.

Edit to definition times a change notification through the following correct definition response. Each edit switches a call between two functions with equal-length names and declarations on different lines. The runner checks that the response points to the newly selected declaration. It polls every 10 ms after stale or empty replies, counting those replies and including the wait in the measurement. A server that never returns the correct location fails the run. Arity and Ark receive incremental changes; languageserver receives full documents, as each advertises during initialization. All 1,000 edits are measured, without discarded warmups. This measures navigation after an edit; it does not measure time to diagnostics for each keystroke. The complete edit workload excludes the final readiness checks and settling waits.

Resident memory is sampled for the server and its descendants after initialization, after opening files, after edits, and at the sampled peak. RSS counts shared pages in each process; PSS apportions them and appears in the tables and tooltips. The grouped bars show median RSS in MiB across fresh processes, with one bar per server at each stage and a linear axis starting at zero. Short-lived peaks or child processes between samples can be missed. The peak RSS, peak PSS, and peak process count can occur at different times. Ark's figures include its embedded R session and descendants. The Python client and Jupyter launcher are outside the sampled process tree.

The servers perform different work and use different diagnostics and package indexes. These are measurements of the same editor workload, not a claim of feature equivalence. The servers retain their default analysis settings. Arity runs with --no-config; R runs with --vanilla; each process gets fresh XDG config and cache directories. Arity's remote index URL is unset. Installed R packages and their help files remain available, so results depend on that library as well as the host. Operating-system file caches are not cleared, and servers are not pinned to one CPU core.

Ark uses the R installation and resolved library paths reported by the selected Rscript. Its version, R home, library paths, and source-fetching environment setting are recorded in the artifact. Ark can download package sources on cache misses, so startup and settling times can include network work. Each session gets a fresh XDG cache, including Ark's source cache. Ark 0.1.252 does not support OAK_SOURCE_FETCHING_ENABLED; setting it does not prevent that release from fetching sources. Newer builds may honor it, so preserve the recorded setting when reproducing a run. The harness does not download or modify Ark itself.

Run the comparison ​

The development shell includes Python, R, languageserver, Ark from nixpkgs, and jupyter_client with its pyzmq dependency. Outside that shell, Ark is discovered on PATH; without it, the runner compares Arity and languageserver. Only the Ark backend requires jupyter_client. The runner requires Linux /proc, Git, Cargo, and the selected servers. It builds Arity in release mode, checks out the pinned corpus under target/bench-lsp/corpus/, and saves server stderr under target/bench-lsp/logs/.

sh
task bench-lsp
task docs-gen

For a short harness check that leaves the published results alone:

sh
task bench-lsp -- --runs 1 --edits 10 --latency-runs 2 \
  --out target/bench-lsp/trial.json

Use --arity /path/to/arity to measure an existing release binary, --rscript /path/to/Rscript to select an R installation, and --ark /path/to/ark to select an Ark R kernel executable. Use --no-ark to omit Ark even when it is installed. Run --help for workload and timeout options. If Ark is available but its Python dependencies are missing, the runner reports the missing dependency instead of silently omitting Ark.

A failed request, missing required diagnostics, an incorrect definition that remains stale until the timeout, a disconnected server, or a settling timeout aborts the run without replacing the artifact. Harness correctness tests run with python3 -m unittest discover -s benches -p 'test_lsp.py'; they do not run the servers or assert performance thresholds.

Measurement setup ​

Opened files: R/pivot-wide.R, R/separate-wider.R, R/pivot-long.R, R/import-standalone-types-check.R, R/chop.R.

Startup and workload ​

Time relative to arity. Hover a point for measurements and sample details. Lower values use less time.
Data table
MeasurementServerMedian (ms)RelativeDetails
Initializearity2.066baselineMedian across fresh processes
Initializelanguageserver992.044480.18× arityMedian across fresh processes
Initializeark699.810338.73× arityMedian across fresh processes
Workspace readyarity152.225baselineMedian across fresh processes
Workspace readylanguageserver4674.95030.71× arityMedian across fresh processes
Workspace readyark761.8685.00× arityMedian across fresh processes
Open files readyarity483.728baselineMedian across fresh processes
Open files readylanguageserver1850.2513.82× arityMedian across fresh processes
Open files readyark121.1600.25× arityMedian across fresh processes
Edit workloadarity1681.057baselineMedian across fresh processes
Edit workloadlanguageserver45888.13227.30× arityMedian across fresh processes
Edit workloadark3889.6732.31× arityMedian across fresh processes

Request latency ​

Latency relative to arity. Hover a point for measurements and sample details. Lower values use less time.
Data table
MeasurementServerMedian (ms)RelativeDetails
Document symbolsarity0.544baselinep95: 0.810 ms; samples: 180; empty: 0; returned items: 66–120; result bytes: 12975–23793; stale responses: 0
Document symbolslanguageserver29.84654.86× arityp95: 36.417 ms; samples: 180; empty: 0; returned items: 6–17; result bytes: 1217–3477; stale responses: 0
Document symbolsark0.5260.97× arityp95: 0.639 ms; samples: 180; empty: 0; returned items: 6–18; result bytes: 2031–5186; stale responses: 0
Hoverarity0.749baselinep95: 0.958 ms; samples: 60; empty: 0; returned items: 1–1; result bytes: 811–811; stale responses: 0
Hoverlanguageserver18.46724.66× arityp95: 19.743 ms; samples: 60; empty: 0; returned items: 1–1; result bytes: 1880–1880; stale responses: 0
Hoverark11.94315.95× arityp95: 14.163 ms; samples: 60; empty: 0; returned items: 1–1; result bytes: 1675–1675; stale responses: 0
Go to definitionarity0.066baselinep95: 0.085 ms; samples: 60; empty: 0; returned items: 1–1; result bytes: 166–166; stale responses: 0
Go to definitionlanguageserver17.730268.64× arityp95: 19.716 ms; samples: 60; empty: 0; returned items: 1–1; result bytes: 166–166; stale responses: 0
Go to definitionark0.1031.56× arityp95: 0.162 ms; samples: 60; empty: 0; returned items: 1–1; result bytes: 274–274; stale responses: 0
Find referencesarity0.070baselinep95: 0.091 ms; samples: 60; empty: 0; returned items: 2–2; result bytes: 335–335; stale responses: 0
Find referenceslanguageserver44.895641.36× arityp95: 48.012 ms; samples: 60; empty: 0; returned items: 2–2; result bytes: 335–335; stale responses: 0
Find referencesark0.2062.94× arityp95: 0.310 ms; samples: 60; empty: 0; returned items: 2–2; result bytes: 335–335; stale responses: 0
Renamearity0.059baselinep95: 0.092 ms; samples: 60; empty: 0; returned items: 2–2; result bytes: 317–317; stale responses: 0
Renamelanguageserver45.045763.47× arityp95: 48.880 ms; samples: 60; empty: 0; returned items: 2–2; result bytes: 317–317; stale responses: 0
Renameark0.2163.66× arityp95: 0.264 ms; samples: 60; empty: 0; returned items: 2–2; result bytes: 317–317; stale responses: 0
Edit to definitionarity1.540baselinep95: 2.317 ms; samples: 3000; empty: 0; returned items: 1–1; result bytes: 166–166; stale responses: 0
Edit to definitionlanguageserver38.60725.07× arityp95: 95.213 ms; samples: 3000; empty: 0; returned items: 1–1; result bytes: 166–166; stale responses: 18
Edit to definitionark3.6662.38× arityp95: 4.945 ms; samples: 3000; empty: 0; returned items: 1–1; result bytes: 274–274; stale responses: 0

Resident memory ​

Median RSS (MiB) at each session stage, with one bar per server on a linear scale starting at zero. Hover a bar for relative memory use, PSS, and process counts.
Data table
MeasurementServerMedian RSS (MiB)RelativeDetails
Initializedarity25.900baselinePSS: 24.1 MiB; processes: 1
Initializedlanguageserver1051.00040.58× arityPSS: 899.3 MiB; processes: 9
Initializedark119.3004.61× arityPSS: 111.0 MiB; processes: 1
Files openarity318.300baselinePSS: 316.5 MiB; processes: 1
Files openlanguageserver1772.8005.57× arityPSS: 1526.8 MiB; processes: 14
Files openark124.2000.39× arityPSS: 116.0 MiB; processes: 1
After editsarity341.600baselinePSS: 339.7 MiB; processes: 1
After editslanguageserver867.7002.54× arityPSS: 823.6 MiB; processes: 3
After editsark132.9000.39× arityPSS: 124.3 MiB; processes: 1
Sampled peakarity361.600baselinePSS: 359.8 MiB; processes: 2
Sampled peaklanguageserver2025.3005.60× arityPSS: 1779.4 MiB; processes: 15
Sampled peakark132.9000.37× arityPSS: 124.3 MiB; processes: 2

Installation ​

Arity is distributed as a single binary. Use the installer below for the command line, or choose a package manager you already use.

For VS Code or Positron, the Arity extension includes the binary, so you can start with editor setup. For formatting inside RStudio, install the R package.

Install script ​

The installer selects the release for your platform and installs to a user-local directory.

sh
curl --proto '=https' --tlsv1.2 -sSf https://arity.cc/install | sh
powershell
powershell -NoProfile -ExecutionPolicy Bypass -Command "irm https://arity.cc/install.ps1 | iex"

Set ARITY_INSTALL_DIR to change the destination or ARITY_TAG to pin a release.

Package managers ​

Cargo ​

Install the Arity CLI from crates.io with Cargo:

bash
cargo install arity

Homebrew ​

On macOS or Linux:

bash
brew install jolars/tap/arity

npm ​

The arity-cli package bundles a prebuilt binary:

bash
npm install -g arity-cli

PyPI ​

Install the binary as a Python tool:

bash
uv tool install arity

Alternatively, use pipx install arity.

Arch Linux ​

Install the prebuilt arity-bin package with an AUR helper:

bash
paru -S arity-bin

Nix ​

Arity is available as arity in Nixpkgs. For a shell with Arity available:

bash
nix shell nixpkgs#arity

For a persistent NixOS installation, add pkgs.arity to environment.systemPackages.

mise and Aqua ​

mise can install Arity through its Aqua backend:

bash
mise use aqua:jolars/arity

Commit the resulting mise.toml to share the selected version. With Aqua directly, run aqua init if the project has no aqua.yaml, then add and install Arity:

bash
aqua g -i jolars/arity
aqua install

Commit aqua.yaml to share the selected version. Both tools use the jolars/arity registry entry.

Prebuilt binaries ​

Download an archive from the releases page and put the arity binary on your PATH.

Editor extensions ​

The VS Code and Open VSX extension bundles the binary and starts the language server automatically. The Zed extension can download it or use an installed copy.

From source ​

Clone the repository and build a release binary:

bash
git clone https://github.com/jolars/arity
cd arity
cargo build --release

The binary is written to target/release/arity.

R package (CRAN) ​

To use the formatter inside R, install the arity package:

r
install.packages("arity")

See the R package documentation for details and RStudio setup for use in the editor.

Verify the installation ​

Check that Arity is available in your terminal:

sh
arity --version

Continue with Getting started to format and lint your first file, or Editor setup to use Arity in your editor.


Overview ​

Arity is a formatter, linter, and language server for R. It keeps your code consistent and gives you feedback as you write.

What Arity does ​

Built on your code ​

Arity parses your code into a lossless syntax tree and updates its analysis as you type. Formatting is deterministic, and formatting an already-formatted file changes nothing. The same parser powers the formatter, linter, and language server.

See the performance comparisons for measurements of the formatter, linter, and language server.

Choose your setup ​

The Installation page covers the standalone installer, package managers, and source builds.

Where to go next ​

For individual commands, settings, and diagnostics, see the CLI reference, Configuration reference, and Lint rules.


Playground ​

Try Arity on R code. Your code stays in your browser and is never executed. Share links include formatting settings only. See the options reference for details.


Command-line help for arity ​

Arity: a language server, formatter, and linter for R

Usage: arity [OPTIONS] <COMMAND>

Options ​

--config <PATH> : Path to an explicit arity.toml (skips discovery and ARITY_CONFIG)

--no-config : Ignore all config files, including ARITY_CONFIG, and use built-in defaults

--color <WHEN> : When to use color in output

Default value: `auto`

Possible values:

- `auto`: Colorize when writing to a terminal and `NO_COLOR` is unset (default)
- `always`: Always colorize
- `never`: Never colorize

-q, --quiet : Suppress informational output (errors are still shown); under format --check this drops the per-file diff, leaving the list of files that would be reformatted and the summary

-v, --verbose : Print extra informational output (e.g. per-command summaries)

arity parse ​

Parse and display the CST tree for debugging

Usage: arity parse [OPTIONS] [FILE]

Arguments ​

<FILE> : Input file. Pass - for stdin, also read when the path is omitted and stdin is not a terminal

Options ​

--stdin-filename <PATH> : Filename the stdin buffer stands for; .Rd selects Rd parsing. Without it, stdin is parsed as R

--quiet : Suppress CST output to stdout

--verify : Verify parser losslessness (input must equal CST text)

arity format ​

Format R files and package DESCRIPTIONs

Usage: arity format [OPTIONS] [PATH]...

Arguments ​

<PATH>... : Input file(s) or director(ies). Pass - for stdin, also read when paths are omitted and stdin is not a terminal

Options ​

--stdin-filename <PATH> : Filename the stdin buffer stands for; decides which grammar it is formatted as. Without it, stdin is formatted as R

--verify : Verify idempotence and R syntax/comment preservation (does not write files)

--check : Check formatting without writing changes; prints a diff for each file that would be reformatted and exits non-zero if any differ. Requires path arguments: there is no file on disk to report on when reading stdin

--line-width <N> : Override the configured line width

--indent-width <N> : Override the configured indent width

--exclude <PATTERN> : Additional gitignore-style exclude patterns (repeatable or comma-separated); augments the configured exclude/extend-exclude

--force-exclude : Apply exclude patterns to files named explicitly on the command line too (they are normally always processed); for runners like pre-commit that pass staged files as arguments

--no-cache : Disable the persistent already-formatted cache (read and write) for this run; only affects --check

arity lint ​

Lint .R files

Reads stdin when given -, or when paths are omitted and stdin is not a terminal. Exit codes: 0 = no findings, 1 = findings (or files blocked by parse errors), 2 = usage/IO error.

Usage: arity lint [OPTIONS] [PATH]...

Arguments ​

<PATH>... : Input file(s) or director(ies). Pass - for stdin, also read when paths are omitted and stdin is not a terminal

Options ​

--stdin-filename <PATH> : Filename to report for stdin input (for diagnostics)

--fix : Apply safe autofixes in place and report what remains

--unsafe-fixes : Also apply fixes that may change behavior (requires --fix)

--select <RULE_ID> : Base rule selection (overrides config select); repeatable or comma-separated

--extend-select <RULE_ID> : Additional rules to run alongside config or --select; repeatable or comma-separated

--ignore <RULE_ID> : Disable these rules (overrides config ignore); repeatable or comma-separated

--exclude <PATTERN> : Additional gitignore-style exclude patterns (repeatable or comma-separated); augments the configured exclude/extend-exclude

--force-exclude : Apply exclude patterns to files named explicitly on the command line too (they are normally always processed); for runners like pre-commit that pass staged files as arguments

--output <OUTPUT> : Output format

Default value: `pretty`

Possible values:

- `pretty`: Annotated multi-line snippets (default; matches jarl/rustc-style output)
- `concise`: One finding per line (`path:line:col: severity [rule] message`)
- `json`: JSON array of diagnostics, for editor integration

arity index ​

Build or refresh the installed-package introspection index

Usage: arity index [OPTIONS] [PATH]...

Arguments ​

<PATH>... : Project path(s) to scan for referenced packages (default: ".")

Options ​

--force : Re-harvest even when the installed version is already indexed

--no-help : Skip harvesting help (names only; faster)

--attach-probe : Probe what each meta-package attaches by running library() in a fresh R session (spawns R and executes package attach hooks; also enabled by setting ARITY_ATTACH_PROBE)

--cache-dir <DIR> : Override the cache directory

--quiet : Suppress per-package progress output

arity lsp ​

Run the language server over stdio

Usage: arity lsp

arity completions ​

Generate a shell completion script (write it to stdout)

Usage: arity completions <SHELL>

Arguments ​

<SHELL> : Shell to generate completions for

Possible values: `bash`, `elvish`, `fish`, `powershell`, `zsh`

arity init ​

Write a starter arity.toml to the current directory

Usage: arity init [OPTIONS]

Options ​

--force : Overwrite an existing arity.toml


Code actions ​

Code actions are the editor's "do something here" menu, served by arity lsp over textDocument/codeAction for the cursor position or selection. Arity offers two families: quick fixes, which come from a lint finding, and refactors, which are computed from the code under the cursor and need no diagnostic.

In VS Code and Positron both families are gated by arity.languageFeatures.enable (see Editor setup).

Quick fixes ​

Every lint finding that carries a fix is offered as a quickfix action when the cursor or selection overlaps the finding's range; a zero-width cursor touching the edge of the range counts as overlapping. The action's title is the fix's own description, and it is attached to the diagnostic, so clients that fix from the lightbulb on a squiggle find it there.

Both safe and unsafe fixes appear. On the command line an unsafe fix is applied only with arity lint --fix --unsafe-fixes, because the CLI edits in bulk; in the editor you are approving one edit at a time with the diff in front of you, so the distinction stops carrying its weight. Which rules have a fix, and whether it is safe, is recorded per rule in the lint rule reference.

A fix is a textual edit and does not owe you layout: it may leave a line the formatter would break differently, because layout is the formatter's job. The intended sequence is fix, then format.

Refactors ​

Add/update roxygen documentation ​

A refactor action that generates or extends the roxygen2 block for the function under the cursor. It is offered when the cursor sits anywhere in a function bound by a simple assignment (name <- function(...)), including inside the body. The function must be the direct value of the assignment, so a function nested in a call on the right-hand side does not qualify.

Add ​

When no roxygen block immediately precedes the function, insert a skeleton above it: a title placeholder, one @param per formal in declaration order, and @return, at the statement's own indentation. A blank line between a block and the function detaches it, following roxygen2's own rule, so a detached block counts as no block.

r
add <- function(x, y = 1) {
  x + y
}

becomes

r
#' Title
#'
#' @param x
#' @param y
#'
#' @return
add <- function(x, y = 1) {
  x + y
}

Update ​

When a block is already attached but some formals are undocumented, insert only the missing @param lines, in formal order, after the last existing @param (or after the introductory prose if there is no @param yet):

r
#' Add two numbers
#'
#' @param x A number.
add <- function(x, y = 1) {
  x + y
}

becomes

r
#' Add two numbers
#'
#' @param x A number.
#' @param y
add <- function(x, y = 1) {
  x + y
}

The action is non-destructive: existing prose and tags are never rewritten, reordered, or removed. Nothing is offered when every formal is already documented. Descriptions are left empty for you to fill in; arity does not invent documentation text.


Configuration reference ​

For a walkthrough of creating and sharing a project config, see the configuration guide.

Arity is configured with a TOML file named arity.toml. All keys are optional; omitting a key uses its default. Keys are kebab-case, and unknown keys are rejected with an error (so a typo never silently falls back to a default).

Run arity init to write a commented starter file.

Editor support ​

Arity publishes a JSON Schema for arity.toml, so editors with TOML support can offer completion, inline documentation, and validation while you edit your configuration.

Schema URL : https://arity.cc/arity.schema.json

The schema is generated from Arity's configuration types and checked against the repository's own arity.toml. It therefore stays aligned with the keys, enums, constraints, and defaults accepted by the CLI. The version at the published URL tracks the latest Arity release.

Until arity.toml is registered with SchemaStore, editors need a manual association. With the Even Better TOML extension for VS Code, add this to your user or workspace settings.json:

jsonc
{
  "evenBetterToml.schema.associations": {
    "^(.*/)?arity\\.toml$": "https://arity.cc/arity.schema.json"
  }
}

Editors and language servers that recognize TOML schema directives can instead put this comment at the top of arity.toml:

toml
#:schema https://arity.cc/arity.schema.json

Other editors—including Neovim with taplo-lsp, Helix, Zed, and IntelliJ—can use the same URL through their JSON Schema association settings.

Discovery ​

For a given file, arity looks for arity.toml by walking up from the file's directory through its ancestors, stopping at the first arity.toml it finds or at a directory containing a .git entry (the repository root), whichever comes first.

If no project config is found, arity loads the file named by the ARITY_CONFIG environment variable. This lets you keep a user config at a custom location, such as a synced drive. Project configs take precedence and replace the user config entirely; files from different discovery steps are not merged.

Relative ARITY_CONFIG paths resolve from the process's working directory. An absolute path is recommended for editor settings. An unset or empty value uses the built-in defaults when no project config is found. A missing or invalid fallback file is a configuration error.

To share settings between projects, put extend = "../shared/arity.toml" at the top level of a project config. Arity resolves the path relative to the file that declares it (and expands a leading ~/ to your home directory), then merges the referenced config before the current file. Chains are allowed, and a cycle or missing file is an error. Child values override inherited values; tables merge by key, so overriding [format] line-width keeps an inherited indent-width. extend-exclude and extend-select arrays append in base-to-child order, while exclude, select, and ignore replace inherited arrays. For a project config or --config file, the selected file still anchors exclude patterns, even when they come from an extended file.

On the command line:

In VS Code or Positron, set the variable in your user settings.json, then run Arity: Restart Server:

json
{
  "arity.serverEnv": {
    "ARITY_CONFIG": "P:/Softwares/arity.toml"
  }
}

Exclude patterns in a project config or an explicit --config file resolve relative to that file's directory. The ARITY_CONFIG fallback has no project location, so its patterns resolve relative to the working directory for CLI walks, or the directory being scanned in the language server.

Top-level keys ​

These apply to both format and lint. exclude and extend-exclude govern the shared file walk.

Key Type Default Description
extend string unset Path to another config file, resolved relative to this file.
exclude array of strings built-in set gitignore-style patterns to skip, anchored according to the config source. Setting it replaces the built-in set (below).
extend-exclude array of strings [] Like exclude, but added to exclude rather than replacing it. Use this to skip extra paths while keeping the built-in defaults.
cache boolean true Enable the persistent result cache (currently the format --check already-formatted cache; the cache directory follows [index] cache-dir/$ARITY_CACHE_DIR). The --no-cache CLI flag overrides it per run.

The built-in default exclude set (the default value of exclude; generated or vendored files that should not be reformatted or linted) is:

.git/
renv/
revdep/
cpp11.R
RcppExports.R
extendr-wrappers.R
import-standalone-*.R

Excludes apply only to directory walks. A file named explicitly on the command line is always processed, even if it matches an exclude pattern. Pass --force-exclude (on format and lint) to apply the patterns to explicitly named files too---useful for runners like pre-commit that pass staged files as arguments. The CLI flag --exclude <PATTERN> (on format and lint) adds to the configured exclude/extend-exclude for a single run.

toml
# Keep the built-in defaults and also skip these:
extend-exclude = ["vendor/", "*.gen.R"]

# Or replace the built-in defaults entirely:
# exclude = ["vendor/", "*.gen.R"]

[format] ​

Key Type Default Description
line-width integer (1–1000) 80 The width the formatter tries to keep lines within. Not a hard cap.
indent-width integer (1–1000) 2 Number of spaces per indentation level.
line-ending string "auto" Newline style: "auto", "lf", "crlf", or "native" (see below).
roxygen boolean true Whether to format #' blocks in R files.
description boolean true Whether a package DESCRIPTION is formatted.

line-ending = "auto" mirrors the source file's first line ending (defaulting to lf when the file has none); "native" is crlf on Windows and lf elsewhere; "lf" and "crlf" force that ending.

toml
[format]
line-width = 80
indent-width = 2
line-ending = "auto"
roxygen = true
description = true

line-width and indent-width can be overridden per run with the --line-width/--indent-width flags on arity format. They apply to DESCRIPTION too, except that its continuation indent is always four spaces — the file format's convention, and a different axis from R-code nesting.

Set roxygen = false to keep each #' block's source layout while formatting the R code around it. This also preserves #' blocks used as Markdown prose by knitr::spin(). The file's configured line-ending still applies to the output.

Setting description = false leaves DESCRIPTION alone, in the CLI (including a buffer piped in under --stdin-filename DESCRIPTION, which is passed through untouched) and in the editor. Reach for it if arity and your package tooling end up disagreeing about the file. Note that extend-exclude is not a substitute: excludes are shared with the linter, so excluding DESCRIPTION would also silence the packaging rules, and the language server applies no exclude filter to formatting at all.

[lint] ​

Key Type Default Description
select array of strings unset Base rule IDs to enable; replaces the default selection.
extend-select array of strings [] Additional rule IDs to enable alongside select or defaults.
ignore array of strings [] Rule IDs to disable, including those in extend-select.

Rule IDs are the kebab-case names from the rule reference. Unknown IDs are reported when linting runs, not when the config is parsed. The --select and --ignore flags on arity lint override the corresponding lists for a single run. --extend-select adds to the configured extend-select list. All three flags accept repeated arguments or comma-separated IDs.

Arity starts with the defaults, or select when set, adds extend-select, and then removes anything in ignore. An empty select = [] disables the defaults; extend-select can still add rules. Duplicate IDs run a rule only once.

toml
[lint]
extend-select = ["undesirable-function"]
ignore = ["unused-binding"]

[lint.rules.<id>] ​

A few rules take options of their own, set in a table named after the rule ID. Rules that take no options have no table.

Unlike select, extend-select, and ignore---where rule IDs are data, checked when linting runs---a rule ID here is part of the schema, so a mistyped one is reported when the config is parsed, alongside any other unknown key.

[lint.rules.cyclomatic-complexity] ​

The opt-in cyclomatic-complexity rule reports functions whose native CFG decision count exceeds max-complexity. The maximum must be a positive integer and defaults to 20. Setting the maximum does not enable the rule.

toml
[lint]
extend-select = ["cyclomatic-complexity"]

[lint.rules.cyclomatic-complexity]
max-complexity = 20

[lint.rules.undesirable-function] ​

The function-name policy for undesirable-function.

Key Type Default Description
functions table of name → hint built-in set Flagged functions. Replaces the built-in set.
extend-functions table of name → hint {} Entries added on top of functions, overriding same-named ones.

The value is the advice shown as the diagnostic's suggestion; an empty string means "no alternative, just don't call this". The functions/extend-functions split works like exclude/extend-exclude: reach for extend-functions unless you really mean to discard the built-in set. Setting functions = {} silences the rule entirely.

The built-in set covers base-R functions that mutate global state (attach, detach, .libPaths, install.packages, setwd, sink, source, options, par, Sys.setenv, Sys.setlocale) and the debugging entry points (debug, debugonce, undebug, trace, untrace). browser() is deliberately absent: it has its own browser rule.

toml
[lint]
select = ["undesirable-function"]

[lint.rules.undesirable-function]
extend-functions = { sapply = "use `vapply()` for a stable return type" }

[compat] ​

The minimum tool versions the project supports, in the spirit of clippy's msrv and ruff's target-version. Consumed by the version-aware lint rules (r-compat, roxygen2-compat): syntax or documentation constructs that need a newer version than the declared floor are flagged.

Key Type Default Description
r version string unset Minimum supported R version, e.g. "4.1".
roxygen2 version string unset The roxygen2 version the project documents with, e.g. "7.3.2".

Values are plain version strings---the key is the >= floor, so there is no operator syntax.

When a key is unset, the floor is derived per file from the enclosing package's DESCRIPTION: Depends: R (>= …) supplies r, and Config/roxygen2/version (written by roxygen2 8.0.0 and later) or the legacy RoxygenNote supplies roxygen2. An explicit key here always wins. With neither a key nor a DESCRIPTION fact, the version-aware rules stay silent, so loose scripts see no false positives.

toml
[compat]
r = "4.1"
roxygen2 = "7.3.2"

[index] ​

Controls the R-package symbol index used by the language server (and by namespace-aware lint rules) to resolve names.

Key Type Default Description
library-paths array of paths [] Explicit R library directories, used when automatic discovery misses.
cache-dir path unset Override the index cache directory (otherwise XDG/$ARITY_CACHE_DIR).
auto-build boolean true Let the language server lazily index referenced-but-unindexed packages.
help boolean true Harvest help titles while indexing. false stores names only (faster).

Note: the downloadable CRAN symbol sidecar is not configured here. Enabling network access is a per-user decision set via the ARITY_REMOTE_URL environment variable, never committed in a shared arity.toml.

Note: the same applies to the attach probe (arity index --attach-probe), which observes what a meta-package attaches by running library() in a fresh R session. Because that executes package attach hooks, it is enabled per run by the flag or per user via the ARITY_ATTACH_PROBE environment variable, never from arity.toml. Without it, attach sets are still captured for packages following the tidyverse core convention, with a built-in table as the offline fallback.

Reserved for future use ​

The following are not yet implemented but are reserved so the schema can grow without breaking changes (adding a key is always backward-compatible under the strict unknown-key check):


Directives ​

A directive is an ordinary # comment that tells arity to stand down. One grammar covers the formatter, the linter, and both at once:

text
# arity[-format|-lint] <verb> [<rule>][: <reason>]

The verb says how far it reaches, the prefix says who it addresses:

formatter linter both
next # arity-format skip: why # arity-lint skip <rule>: why # arity skip: why
from # arity-format off # arity-lint off <rule> # arity off
to # arity-format on # arity-lint on # arity on
file # arity-format skip-file: why # arity-lint skip-file <rule>: why # arity skip-file: why

Only a lint directive names a rule. # arity-format has no lint half to scope, and # arity covers every rule by construction.

skip — the next statement ​

Applies to the next non-trivia sibling: the next piece of code after the comment, whatever that is. 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.

r
# arity-lint skip unused-binding: part of the documented API
config <- list(width = 80)

A trailing comment attaches the same way — to the code that follows it, not the code on its own line:

r
x <- 1 # arity-lint skip browser: applies to the NEXT statement, not this one
browser()

Inside a call or subscript, a lint skip between arguments applies only to the next argument, including any expressions nested inside it. Commas and comments between the directive and that argument do not change its target:

r
list(
  browser(),
  # arity-lint skip browser: intentional debugging hook
  hook = browser(),
  browser()
)

Only hook = browser() is suppressed. If no argument follows before the closing delimiter, the directive is dangling and outdated-suppression reports it.

For the formatter, skip hands the marked statement back byte for byte — its own column, its interior alignment, its blank lines. Nothing about its layout is decided, which is the whole point:

r
# arity-format skip: the rows are the matrix
m <- matrix(c(1, 0,
              0, 1), nrow = 2)

off … on — a region ​

Everything between the two markers, or to the end of the file if the on never comes. The markers themselves are ordinary comments and are formatted normally.

r
# arity-format off: generated by tools/codegen.R
lookup <- c(
  "a" = 1,
    "bb"  = 22
)
# arity-format on

An on closes every region opened with the same prefix. # arity off and # arity-format off are separate regions, and one does not close the other; an on that closes nothing is reported by misplaced-suppression.

skip-file — the whole file ​

For a generated or vendored file. # arity-format skip-file makes arity format hand the file back unchanged, so --check reports it clean.

r
# arity-lint skip-file unused-binding: generated by tools/codegen.R

Every rule at once ​

Writing a : where the rule ID would go widens a lint directive to every rule, including every rule arity ships in the future:

r
# arity-lint skip-file: generated, do not lint

The # arity column does the same by construction. Both are rarely what you want at file or region scope; prefer the rule-scoped form, which blanket-suppression will not flag.

In DESCRIPTION ​

The lint directives work in a DESCRIPTION too, on a line of their own:

text
Package: mypkg
# arity-lint skip unused-dependency: loaded reflectively by the plugin registry
Imports: somepkg

DCF has no trailing comments — a # in the middle of a value is part of that value — so a directive must start at column zero, and one written after a field applies to the field that follows it. A # line between the continuation lines of a single field is the exception: R's read.dcf skips it and resumes the value, so a directive there covers the whole field it interrupts.

Of the formatter directives, only # arity-format skip-file is honored there.

Reasons ​

The text after the : is free-form and arity never interprets it — but telling a tool to stand down is a standing claim that it 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.

Directives are linted too ​

Directives fail silently by nature: when one goes wrong, the symptom is that nothing happens, which is exactly what success looks like. Six meta rules make those failures visible:

Rule Flags
misnamed-suppression a rule ID or a verb that does not exist
misplaced-suppression a directive that can never take effect
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
deprecated-suppression one of the spellings arity shipped with

They read the directives of .R files only; a directive in a DESCRIPTION is honored but not linted.

Limits ​

Deprecated spellings ​

# arity-ignore <rule>: <reason> and # arity-ignore-file <rule>: <reason> are what the linter shipped with. They still work, and mean exactly # arity-lint skip and # arity-lint skip-file — but they are deprecated, and deprecated-suppression flags them with a safe autofix, so arity lint --fix migrates a codebase in one pass:

sh
arity lint --fix --select deprecated-suppression .

Mixing the two (# arity-ignore skip <rule>) is an error, and misnamed-suppression reports it.

Turning a rule off entirely ​

For a rule you never want, arity.toml is the better tool than a comment in every file:

toml
[lint]
ignore = ["unused-binding"]

See Configuration.


Lint rules ​

arity lint runs a set of built-in rules over each file and reports a finding for every match. This page is the catalogue: one section per rule, keyed by its stable rule ID. That ID is what a finding reports, what select/ignore target in the [lint] table, and what an # arity-lint skip comment names (see Directives).

Where a rewrite is unambiguous a rule carries an autofix. A safe fix (shown below as "After applying the fix") is applied by arity lint --fix; an unsafe one is applied only with --unsafe-fixes or as an editor code action, so it has no "after" block here. A fix is a textual edit and never lays code out, so the intended pipeline is fix-then-format.

Every example below is linted live to produce its diagnostic and fixed output, so this page never drifts from the rules' actual behavior.

Correctness ​

undefined-symbol ​

Flag an identifier read that resolves to no in-scope binding and no known package export.

Gated for safety: the rule stays silent for a whole file unless every library()-attached package is indexed, since an un-indexed package could export the otherwise-unresolved name. In an analyzed package, a package-local call argument is checked only when its matched formal is proven to evaluate the promise normally; capture, opaque forwarding, and ambiguous behavior stay silent.

Suggest a visible binding or known attached export only when a single name differs by one insertion, deletion, substitution, or adjacent transposition. Short names (fewer than four characters), distant or ambiguous spellings, and searches exceeding a fixed budget receive no hint. Suggestions do not provide an automatic fix.

This rule is enabled by default.

subtotal resolves to nothing:

r
total <- subtotal
text
warning: undefined-symbol
 --> example.R:1:10
  |
1 | total <- subtotal
  |          ^^^^^^^^ no in-scope binding or attached package exports `subtotal`

A unique close spelling receives a hint:

r
lenth(1:3)
text
warning: undefined-symbol
 --> example.R:1:1
  |
1 | lenth(1:3)
  | ^^^^^ no in-scope binding or attached package exports `lenth`
  = help: did you mean `length`?

unused-binding ​

Flag a local binding that is never read in the same file. Function parameters, for-loop variables, and names beginning with . are exempt, since those are meaningful even when unused. A function bound to a generic.class name is exempt too: S3 dispatch reaches a method without reading its name, registered in the NAMESPACE or not.

This rule is enabled by default.

x is assigned but never used:

r
x <- 1
y <- 2
print(y)
text
warning: unused-binding
 --> example.R:1:1
  |
1 | x <- 1
  | ^ local binding `x` is assigned but never read
  = help: Remove the assignment, or prefix the name with `.` to mark it intentional.

duplicate-formal ​

Flag a function defined with two parameters of the same name. R raises a runtime error (repeated formal argument); this catches it statically.

This rule is enabled by default.

Two parameters named x:

r
f <- function(x, x) x
text
error: duplicate-formal
 --> example.R:1:18
  |
1 | f <- function(x, x) x
  |                  ^ parameter `x` is declared more than once in this function
  = help: Rename one of the parameters.

duplicated-arguments ​

Flag a call that supplies the same argument name more than once (f(a = 1, a = 2)). The call-side sibling of duplicate-formal; reported as a warning with no autofix, since it isn't always a runtime error.

This rule is enabled by default.

The argument a is supplied twice:

r
list(a = 1, a = 2)
text
warning: duplicated-arguments
 --> example.R:1:13
  |
1 | list(a = 1, a = 2)
  |             ^ argument `a` is supplied more than once in this call
  = help: Remove or rename the duplicate argument.

equals-na ​

Flag x == NA, which is always NA rather than TRUE/FALSE—almost always a mistake for is.na(x), which is the autofix.

This rule is enabled by default.

Comparing to NA with ==:

r
x == NA
text
warning: equals-na
 --> example.R:1:1
  |
1 | x == NA
  | ^^^^^^^ comparison with `NA` is always `NA`; use `is.na()`
  = help: Use `is.na(x)`.

After applying the fix:

r
is.na(x)

equals-nan ​

Flag ==, !=, and %in% comparisons with NaN; use is.nan() to test for NaN values.

This rule is enabled by default.

Comparing a value with NaN:

r
if (x == NaN) handle_nan()
text
warning: equals-nan
 --> example.R:1:5
  |
1 | if (x == NaN) handle_nan()
  |     ^^^^^^^^ comparison with `NaN` does not reliably test for NaN values
  = help: Use `is.nan(x)`.

After applying the fix:

r
if (is.nan(x)) handle_nan()

equals-null ​

Flag ==, !=, and %in% comparisons with NULL; use is.null() for a scalar null test.

This rule is enabled by default.

Comparing a value with NULL:

r
if (x == NULL) handle_null()
text
warning: equals-null
 --> example.R:1:5
  |
1 | if (x == NULL) handle_null()
  |     ^^^^^^^^^ comparison with `NULL` does not produce a scalar null test
  = help: Use `is.null(x)`.

After applying the fix:

r
if (is.null(x)) handle_null()

missing-argument ​

Flag empty call arguments, including trailing and named holes in resolved base list() calls and c() calls with only atomic literal values. Unknown or potentially dispatching callees retain the trailing-hole exemption. Function-formal defaults are excluded.

This rule is enabled by default.

The second call argument is missing:

r
paste("a", , "b")
text
warning: missing-argument
 --> example.R:1:12
  |
1 | paste("a", , "b")
  |            ^ call contains an empty argument before this comma
  = help: Supply the intended argument explicitly.

Base list and literal c calls reject trailing or named holes:

r
list(1,)
c(value = )
text
warning: missing-argument
 --> example.R:1:7
  |
1 | list(1,)
  |       ^ base call rejects this empty argument
  = help: Supply the intended argument explicitly.
warning: missing-argument
 --> example.R:2:3
  |
2 | c(value = )
  |   ^^^^^^^^ base call rejects this empty argument
  = help: Supply the intended argument explicitly.

rep-times-ignored ​

Flag a base rep() call that supplies both times and length.out. length.out normally determines the result length, making times ineffective. There is no autofix because times can still matter when length.out is invalid or NA.

This rule is enabled by default.

length.out normally overrides times:

r
rep(x, times = 2, length.out = 10)
text
warning: rep-times-ignored
 --> example.R:1:8
  |
1 | rep(x, times = 2, length.out = 10)
  |        ^^^^^ `times` is normally ignored when `length.out` is supplied
  = help: Remove `times` after confirming `length.out` is always valid.

sprintf ​

Validate literal formats passed to base sprintf() and gettextf(): flag invalid conversions, definitely missing or excess arguments, and platform-dependent zero padding of strings (0 plus a width on %s). Use explicit string padding or an appropriate numeric conversion instead; neither is a general safe rewrite. A literal-only sprintf() call has a safe autofix. Literal-only gettextf() calls retain translation.

This rule is enabled by default.

A literal format with no fields needs no sprintf() call:

r
label <- sprintf("ready: 100%%")
text
warning: sprintf
 --> example.R:1:10
  |
1 | label <- sprintf("ready: 100%%")
  |          ^^^^^^^^^^^^^^^^^^^^^^^ `sprintf()` is pointless because the format has no fields
  = help: Use the string literal directly.

After applying the fix:

r
label <- "ready: 100%"

Zero padding of strings depends on the platform:

r
label <- sprintf(f = "%05s", "x")
text
warning: sprintf
 --> example.R:1:23
  |
1 | label <- sprintf(f = "%05s", "x")
  |                       ^^^^ `sprintf()` string conversion `%05s` has platform-dependent zero padding
  = help: Use explicit string padding or an appropriate numeric conversion.

The same portability check applies to translated formats:

r
label <- gettextf("%0*s", 5, "x", domain = NA)
text
warning: sprintf
 --> example.R:1:20
  |
1 | label <- gettextf("%0*s", 5, "x", domain = NA)
  |                    ^^^^ `gettextf()` string conversion `%0*s` has platform-dependent zero padding
  = help: Use explicit string padding or an appropriate numeric conversion.

vector-logic ​

Flag the vectorized &/| used directly in an if/while condition, where the scalar &&/|| is meant.

A condition needs a single TRUE/FALSE: R only looks at the first element (a length > 1 condition is an error since R 4.2), and &&/|| short-circuit. The fix doubles the operator. Operators inside a function call (if (any(a | b))) are left alone—a vector result is the point there.

This rule is enabled by default.

Vectorized & in an if condition:

r
if (a & b) {
  go()
}
text
warning: vector-logic
 --> example.R:1:7
  |
1 | if (a & b) {
  |       ^ `&` in a condition; use `&&`
  = help: Use the scalar `&&` in an `if`/`while` condition.

After applying the fix:

r
if (a && b) {
  go()
}

unreachable-code ​

Flag statements that follow an unconditional return() or stop() in a block—once either runs, nothing after it in the same block can be reached, so the trailing code is dead. A direct-statement if/else that exits in both branches likewise leaves its tail unreachable (a control-flow-graph verdict).

The rule fires only when the terminator is a direct statement of the block (a lone return()/stop() guarded by an if leaves the tail reachable) and only when the callee resolves to base R; a local redefinition is left alone. return is additionally required to sit inside a function. The deletion fix is unsafe, and withheld when it would drop a comment.

This rule is enabled by default.

A statement after return() can never run:

r
f <- function() {
  return(1)
  2
}
text
warning: unreachable-code
 --> example.R:3:3
  |
3 |   2
  |   ^ code after `return()` can never be reached
  = help: Remove the unreachable code, or fix the control flow.

An if/else that exits in both branches leaves its tail dead:

r
f <- function() {
  if (x) return(1) else return(2)
  3
}
text
warning: unreachable-code
 --> example.R:3:3
  |
3 |   3
  |   ^ code after this `if` can never be reached (both branches exit)
  = help: Remove the unreachable code, or fix the control flow.

is-numeric ​

Flag is.numeric(x) || is.integer(x) (and the vectorized | spelling), which is just is.numeric(x): is.numeric() already returns TRUE for integer vectors, so the disjunction adds nothing and suggests a misreading of what is.numeric() tests.

The rule fires only when both operands are single-argument calls on the same argument and both callees resolve to base R; a local redefinition of either is left alone.

This rule is enabled by default.

Testing for a numeric vector:

r
if (is.numeric(x) || is.integer(x)) mean(x)
text
warning: is-numeric
 --> example.R:1:5
  |
1 | if (is.numeric(x) || is.integer(x)) mean(x)
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `is.numeric(x) || is.integer(x)` is redundant—`is.numeric()` is already `TRUE` for integer vectors
  = help: Use `is.numeric(x)`.

After applying the fix:

r
if (is.numeric(x)) mean(x)

if-always-true ​

Flag an if whose condition is the literal TRUE or FALSE. The branch is decided statically, so the if is dead control flow. Only the bare literals are flagged—not folded constants (if (1 == 1)) or the rebindable symbols T/F.

This rule is enabled by default.

An if gated on a constant always takes the same branch:

r
if (TRUE) {
  f()
} else {
  g()
}
text
warning: if-always-true
 --> example.R:1:5
  |
1 | if (TRUE) {
  |     ^^^^ `if` condition is always `TRUE`
  = help: The condition always holds; the branch always runs.

empty-assignment ​

Flag an assignment whose value is an empty block (x <- {}). An empty block evaluates to NULL, so this is a roundabout x <- NULL—usually a leftover from deleting the block's body. An empty function body or if branch is not flagged.

This rule is enabled by default.

Assigning an empty block is the same as assigning NULL:

r
x <- {}
text
warning: empty-assignment
 --> example.R:1:6
  |
1 | x <- {}
  |      ^^ assigning an empty block `{}` is the same as assigning `NULL`
  = help: Assign `NULL` or a meaningful value instead.

download-file ​

Flag a download.file() call whose mode is not portable.

The default mode = "w" is text mode: on Windows it translates line endings, corrupting any binary payload, while the same call works on Unix. R recommends mode = "wb" (or "ab" to append), so the rule reports an omitted mode, an explicit mode = "w" / "a", and a mode supplied next to method = "curl" / "wget" (which shell out and ignore it).

Arguments are matched the way R matches them, so a positional or partially-named method/mode is understood. The callee must resolve to base R, and a mode/method that is not a string literal is skipped rather than guessed at. There is no autofix: the shapes need an argument inserted or deleted, not rewritten.

This rule is enabled by default.

Relying on the default mode = "w", which corrupts a binary download on Windows:

r
download.file(url, destfile)
text
warning: download-file
 --> example.R:1:1
  |
1 | download.file(url, destfile)
  | ^^^^^^^^^^^^^ `download.file()` relies on the default `mode = "w"`, which corrupts binary downloads on Windows
  = help: Pass `mode = "wb"` (or `mode = "ab"` to append).

mode is ignored by method = "curl" and method = "wget":

r
download.file(url, destfile, method = "curl", mode = "wb")
text
warning: download-file
 --> example.R:1:47
  |
1 | download.file(url, destfile, method = "curl", mode = "wb")
  |                                               ^^^^^^^^^^^ `mode` is ignored by `download.file(method = "curl")`
  = help: Drop the `mode` argument, or use a `method` that honors it (`"curl"` shells out to an external downloader).

internal-function ​

Flag pkg:::name, which reaches past a package's namespace to an object it never exported.

An unexported object is not part of the package's interface: it carries no compatibility promise, no documentation, and no deprecation cycle, so it can be renamed, reshaped, or removed in any patch release—and the breakage surfaces only at run time. CRAN's policy bars a package from using ::: on a package in its own Depends/Imports/Suggests for the same reason.

The exported form pkg::name is never flagged, and neither is a package reaching into its own internals: mypkg:::helper inside mypkg is a redundant qualifier in R/ and the idiomatic way to unit-test an unexported function in tests/, so the rule reads the enclosing package's name from DESCRIPTION and skips a self-reference.

There is no autofix: the repair is to find an exported equivalent, vendor the implementation, or ask upstream to export it—rewriting ::: to :: would only turn a working call into a load-time error.

This rule is enabled by default.

Calling an unexported function through ::::

r
utils:::.getHelpFile(path)
text
warning: internal-function
 --> example.R:1:1
  |
1 | utils:::.getHelpFile(path)
  | ^^^^^^^^^^^^^^^^^^^^ `utils:::.getHelpFile` uses an unexported object, which may change or disappear without notice
  = help: Use an exported function from `utils`, or ask upstream to export `.getHelpFile`.

r-compat ​

Flag syntax newer than the project's minimum supported R version.

The floor comes from [compat] r in arity.toml, or from Depends: R (>= …) in the package DESCRIPTION when the key is unset; with neither, the rule stays silent. Raw strings (r"(…)") need R 4.0.0, the native pipe |> and the lambda shorthand \(x) need 4.1.0, and the pipe placeholder _ needs 4.2.0 — on an older R, each is a syntax error. Only the lambda carries a fix (function(x) is its exact meaning); the pipe and raw strings have no drop-in textual equivalent, so those findings are report-only.

This rule is enabled by default.

The native pipe under a declared R (>= 4.0) floor (r = "4.0" under [compat] in arity.toml):

r
y <- c(1, 2) |> sum()
print(y)
text
warning: r-compat
 --> example.R:1:14
  |
1 | y <- c(1, 2) |> sum()
  |              ^^ the native pipe `|>` requires R >= 4.1.0, but this project supports R >= 4.0
  = help: Raise the floor (`[compat] r` in `arity.toml`, or `Depends: R (>= …)` in `DESCRIPTION`) or rewrite with older syntax.

Suspicious ​

assignment-in-condition ​

Flag an assignment (<-, =, <<-, :=) used as the direct condition of an if/while. The bare = form (often a == typo) is autofixed to ==; the others are reported without a fix.

This rule is enabled by default.

= where == was meant:

r
if (x = 5) print(x)
text
warning: assignment-in-condition
 --> example.R:1:5
  |
1 | if (x = 5) print(x)
  |     ^^^^^ assignment used as a condition; did you mean `==`?
  = help: Replace `=` with `==` or move the assignment out.

After applying the fix:

r
if (x == 5) print(x)

implicit-assignment ​

Flag an assignment (<-, =, <<-, ->, ->>) nested inside a call or subscript argument, e.g. mean(x <- 1:10). The binding runs as a side effect of the argument and is easy to miss; assign on its own line instead. The if/while condition case is covered by assignment-in-condition, and the data.table / rlang walrus (:=) is left alone.

This rule is disabled by default; enable it with select.

An assignment hidden inside a call argument:

r
mean(x <- 1:10)
text
warning: implicit-assignment
 --> example.R:1:6
  |
1 | mean(x <- 1:10)
  |      ^^^^^^^^^ assignment nested in a call argument; assign on its own line
  = help: Move the assignment to its own statement.

browser ​

Flag a leftover browser() call. browser() opens R's interactive debugger and is meant to be removed before code is committed; in a non-interactive session it silently does nothing, so it lingers unnoticed.

Only a call that resolves to base R's browser is flagged—a same-named user function is left alone. The safe-delete fix is offered only for a browser() that is a direct statement (of a block or the file top level); in any other position it is withheld so the edit can't break syntax.

This rule is enabled by default.

A browser() call left in after debugging:

r
f <- function(x) {
  browser()
  x + 1
}
text
warning: browser
 --> example.R:2:3
  |
2 |   browser()
  |   ^^^^^^^^^ leftover `browser()` debugging call
  = help: Remove the `browser()` call.

After applying the fix:

r
f <- function(x) {
  x + 1
}

shadowed-builtin ​

Flag a local binding to a function whose name is exported by a default R package when that name is later called in the same scope (c <- function(...) ...; c(2, 3)). A value binding (names <- names(x)) is exempt: R's call-position lookup skips non-function locals, so it is not a hazard.

This rule is enabled by default.

Binding a function over base c() and then calling it:

r
c <- function(x, y) x
c(2, 3)
text
warning: shadowed-builtin
 --> example.R:1:1
  |
1 | c <- function(x, y) x
  | ^ local binding `c` shadows a base-R name later used in this scope
  = help: Rename the local, or fully qualify the base call (e.g. `base::c`).

redundant-equals ​

Flag comparison to a logical literal: x == TRUE can usually be written as x, and x == FALSE as !x. The fix is unsafe because equality coerces non-logical operands while the direct form does not.

This rule is enabled by default.

Comparing to TRUE:

r
if (ready == TRUE) go()
text
warning: redundant-equals
 --> example.R:1:5
  |
1 | if (ready == TRUE) go()
  |     ^^^^^^^^^^^^^ comparison with a logical literal is redundant
  = help: Use the expression directly, or negate it.

redundant-ifelse ​

Flag ifelse(c, TRUE, FALSE) (which is just c) and ifelse(c, FALSE, TRUE) (which is !c).

This rule is enabled by default.

An ifelse that returns its own condition:

r
flag <- ifelse(cond, TRUE, FALSE)
text
warning: redundant-ifelse
 --> example.R:1:9
  |
1 | flag <- ifelse(cond, TRUE, FALSE)
  |         ^^^^^^^^^^^^^^^^^^^^^^^^^ `ifelse()` returning `TRUE`/`FALSE` is redundant
  = help: Use the condition directly, or negate it.

After applying the fix:

r
flag <- cond

all-equal ​

Flag all.equal() used directly as a condition, negated, or passed to isFALSE(). A disagreement returns a character vector rather than FALSE, so these forms do not reliably test equality. Use isTRUE(all.equal(...)) instead. Only base-R callees are flagged. The fix is unsafe because it deliberately changes existing behavior.

This rule is enabled by default.

Testing the return value of all.equal() directly:

r
if (all.equal(actual, expected)) pass()
text
warning: all-equal
 --> example.R:1:5
  |
1 | if (all.equal(actual, expected)) pass()
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `all.equal()` does not return `FALSE` for unequal objects
  = help: Use `isTRUE(all.equal(...))` to test equality.

pipe-return ​

Flag base return used directly on the right-hand side of the magrittr pipe %>%, whether written as return() or a bare name. It returns from the pipe stage rather than from the surrounding function, so the apparent early return is misleading. Wrap the whole pipeline in return(), or assign its result and return that value. No fix is offered because the intended control flow cannot be inferred. A locally redefined %>% is left alone.

This rule is enabled by default.

A return() stage does not exit the surrounding function:

r
f <- function(x) {
  x %>% sum() %>% return()
  FALSE
}
text
warning: pipe-return
 --> example.R:2:19
  |
2 |   x %>% sum() %>% return()
  |                   ^^^^^^^^ `return` after `%>%` does not exit the surrounding function
  = help: Wrap the pipeline in `return()`, or assign and return its result.

bare-return ​

Flag a standalone base return in a function body or control-flow branch. The bare symbol evaluates to the function object without calling it, so execution continues. Use return() to exit the function. The fix is unsafe because it changes control flow. Shadowed names, quoted code, and value uses such as ret <- return or lapply(xs, return) are left alone.

This rule is enabled by default.

A bare return does not exit the function:

r
f <- function() {
  return
  42
}
f()
text
warning: bare-return
 --> example.R:2:3
  |
2 |   return
  |   ^^^^^^ bare `return` does not exit the function
  = help: Use `return()` to exit the function.

function-return-assignment ​

Flag an assignment passed directly to base return(). The assigned value is returned, but the binding remains as a side effect. Move the assignment before return() or return the value directly. No fix is offered because the intended behavior cannot be inferred.

This rule is enabled by default.

Assigning while returning a value:

r
f <- function() return(result <- compute())
text
warning: function-return-assignment
 --> example.R:1:24
  |
1 | f <- function() return(result <- compute())
  |                        ^^^^^^^^^^^^^^^^^^^ assignment inside `return()` has a side effect
  = help: Move the assignment before `return()` or return the value directly.

list-comparison ​

Flag direct comparisons involving base list(), pairlist(), lapply(), or Map() calls, including parenthesized operands. List comparisons depend on coercion and may fail for non-scalar elements. Prefer a typed iterator such as vapply() with an explicit result template before comparing. Only simple base-resolved callees are checked; variables, qualified calls, shadowed functions, and quoted code are left alone. No automatic fix is offered because the intended element type and comparison are unknown.

This rule is enabled by default.

Compare a typed result instead of a list:

r
lapply(x, length) > 1
text
warning: list-comparison
 --> example.R:1:19
  |
1 | lapply(x, length) > 1
  |                   ^ Direct list comparison relies on element coercion
  = help: Use a typed iterator such as `vapply()` before comparing.

terminal-close ​

Flag a direct base close() call at the end of a function, including an unbraced body or a tail wrapped in blocks or parentheses. Errors or early returns before that call can skip cleanup. Register on.exit(close(con), add = TRUE) immediately after acquiring the connection so cleanup runs when the function exits; see R's on.exit() documentation.

This rule is opt-in because a function may intentionally take ownership of a caller's connection or expose the result of close(). No automatic fix is offered: moving cleanup can change ownership, timing, and the return value. Only simple calls that resolve to base R are checked; shadowed or qualified callees, quoted code, conditional cleanup, and calls nested inside other operations are left alone.

This rule is disabled by default; enable it with select.

An error before the last statement skips cleanup:

r
read_file <- function(path) {
  con <- file(path)
  print(readLines(con))
  close(con)
}
text
warning: terminal-close
 --> example.R:4:3
  |
4 |   close(con)
  |   ^^^^^^^^^^ `close()` at the end of a function can be skipped by errors or early returns
  = help: Register cleanup with `on.exit(..., add = TRUE)` immediately after acquiring the connection.

strings-as-factors ​

Set stringsAsFactors explicitly in data.frame() when supported R versions span the R 4.0.0 default change from TRUE to FALSE. The rule runs only with a declared R floor below 4.0, resolved from [compat] r or DESCRIPTION. With no floor, or a floor of 4.0 or later, it stays silent.

Known character columns include string literals and base c() calls made entirely from atomic literals with at least one string. Unknown values and columns protected by I() are left alone. Only base-resolved calls are checked. No fix is offered because either factors or character vectors may be intended.

This rule is enabled by default.

With a declared R 3.6 compatibility floor:

r
data.frame(label = c("a", "b"))
text
warning: strings-as-factors
 --> example.R:1:20
  |
1 | data.frame(label = c("a", "b"))
  |                    ^^^^^^^^^^^ This character column depends on the `stringsAsFactors` default changed in R 4.0.0
  = help: Set `stringsAsFactors = TRUE` or `stringsAsFactors = FALSE` explicitly.

partial-argument-match ​

Flag successful partial argument-name matches to statically resolved local and package-local closures. Use the full formal name so an API addition cannot make the abbreviation ambiguous or redirect it to another argument. Exact matches and names captured by ... are left alone. Unknown callees, reassignments, conditional definitions, dispatch, forwarded ..., and pipe calls are skipped. Indexed package functions are not checked yet. The name-only fix is unsafe because functions can inspect the original call's argument names.

This rule is enabled by default.

Spell out the formal name instead of relying on its prefix:

r
f <- function(alpha) alpha
f(al = 1)
text
warning: partial-argument-match
 --> example.R:2:3
  |
2 | f(al = 1)
  |   ^^ argument `al` partially matches `alpha`
  = help: Use the full argument name `alpha`.

confusable-identifier ​

Flag unquoted identifiers made entirely of ASCII characters and a conservative set of Cyrillic lookalikes or fullwidth Latin letters. Report the lookalikes' Unicode code points and the likely ASCII spelling. R treats these spellings as different names.

Greek letters, accented Latin letters, and names containing other non-Latin letters are left alone. Entirely Cyrillic names can still be reported if every letter resembles ASCII. Strings, comments, roxygen, and backtick names are ignored. This is a visual warning, not a ban on non-Latin identifiers or a complete Unicode confusability check; see Unicode's confusability guidance. No automatic fix is offered because the intended binding is unknown.

This rule is disabled by default; enable it with select.

Cyrillic с looks like Latin c but defines a different binding:

r
с <- 1
text
warning: confusable-identifier
 --> example.R:1:1
  |
1 | с <- 1
  | ^ identifier `с` contains ASCII lookalikes (U+0441); likely ASCII spelling is `c`
  = help: Check which spelling is intended; R treats these as different names.

A Cyrillic а can hide inside an otherwise ASCII name:

r
pаyload <- 1
text
warning: confusable-identifier
 --> example.R:1:1
  |
1 | pаyload <- 1
  | ^^^^^^^ identifier `pаyload` contains ASCII lookalikes (U+0430); likely ASCII spelling is `payload`
  = help: Check which spelling is intended; R treats these as different names.

repeat ​

Flag while (TRUE), an unconditional loop better written as repeat.

repeat states the intent—loop until a break/return—without the dummy TRUE condition. Only the reserved literal TRUE is matched; the rebindable T is left to true-false-symbol.

This rule is enabled by default.

An unconditional while loop:

r
while (TRUE) {
  poll()
}
text
warning: repeat
 --> example.R:1:1
  |
1 | while (TRUE) {
  | ^^^^^^^^^^^^ `while (TRUE)` is an unconditional loop; use `repeat`
  = help: Write `repeat` for a loop with no exit condition.

After applying the fix:

r
repeat {
  poll()
}

undesirable-function ​

Flag a call to a function the project has banned, with the configured alternative as the suggestion.

The name -> suggestion map is set in [lint.rules.undesirable-function]: functions replaces the built-in set, extend-functions adds to it. The built-in set covers base-R functions that mutate global state (attach, setwd, options, Sys.setenv, ...) and the debugging entry points (debug, trace, ...); browser() is left to the dedicated browser rule.

Only bare-name calls are flagged, and a locally redefined name is skipped. There is no autofix — the rule knows the call is unwanted, not what should replace it.

This rule is disabled by default; enable it with select.

attach() is in the built-in set — it puts a data frame's columns on the search path, so later code silently depends on load order:

r
attach(mtcars)
mean(mpg)
text
warning: undesirable-function
 --> example.R:1:1
  |
1 | attach(mtcars)
  | ^^^^^^ call to undesirable function `attach`
  = help: Avoid `attach()`: use `with()` or refer to columns explicitly.

for-loop-index ​

Flag a for loop whose index symbol is also read in its own sequence expression, as in for (x in x) or for (x in seq_along(x)). R evaluates the sequence once and then binds the index over it, so the original value is destroyed by the first iteration and is not what a reader would expect after the loop.

Only a genuine read of the name counts: a field name (for (x in df$x)), an argument name (for (x in list(x = 1))), or a read belonging to a function literal inside the sequence is not a re-use and is not flagged. No fix is offered—the repair is to rename the index or the sequence, which means inventing a name.

This rule is enabled by default.

The loop index overwrites the vector being iterated over:

r
for (x in x) {
  print(x)
}
text
warning: for-loop-index
 --> example.R:1:6
  |
1 | for (x in x) {
  |      ^^^^^^ loop index `x` is also read in the loop's sequence
  = help: Rename the loop index so iterating does not overwrite `x`.

The same mistake one call deep:

r
for (i in seq_along(i)) {
  print(i)
}
text
warning: for-loop-index
 --> example.R:1:6
  |
1 | for (i in seq_along(i)) {
  |      ^^^^^^^^^^^^^^^^^ loop index `i` is also read in the loop's sequence
  = help: Rename the loop index so iterating does not overwrite `i`.

for-loop-dup-index ​

Flag a nested for loop that reuses the index variable of an enclosing for loop. R loops introduce no scope, so the inner loop overwrites the outer index rather than shadowing it: the outer loop resumes with a corrupted counter and any later read of the name sees the inner loop's last value.

A loop nested inside a function defined in the outer body is not flagged—it runs in its own frame and leaves the outer index alone. No fix is offered, since the repair is to invent a new index name.

This rule is enabled by default.

The inner loop overwrites the outer loop's counter:

r
for (i in 1:10) {
  for (i in 1:5) {
    print(i)
  }
}
text
warning: for-loop-dup-index
 --> example.R:2:8
  |
2 |   for (i in 1:5) {
  |        ^^^^^^^^ loop index `i` is already the index of an enclosing `for` loop
  = help: Rename this loop index so it does not overwrite the enclosing loop's `i`.

unused-function ​

Flag an exported function that nothing in the project calls. The complement of unused-binding, which stays quiet on public API: a function is reported here only when it is declared exported (a roxygen @export, or a NAMESPACE export()) and no file that can see it reads it. S3 methods are exempt — dispatch reaches them without a direct call, so having no caller says nothing about them. Disabled by default, since a library's exported functions are meant to be called from outside the project.

This rule is disabled by default; enable it with select.

add_one is exported but never called anywhere in the package:

r
#' Add one
#'
#' @export
add_one <- function(x) {
  x + 1
}
text
warning: unused-function
 --> example.R:4:1
  |
4 | add_one <- function(x) {
  | ^^^^^^^ exported function `add_one` is never called
  = help: Remove it, or stop exporting it if it is not part of the public API.

duplicated-function-definition ​

Flag a function name defined twice among the same run of statements, where the earlier definition is replaced before it is ever used. R evaluates both assignments, so every call reaches the second one and the first body is dead code — nearly always a copy-paste or merge artifact.

Only definitions that are siblings in one statement list are paired, so definition-by-condition (if (x) f <- function() 1 else f <- function() 2) is not flagged: only one branch runs. A redefinition that follows a genuine use of the earlier definition is not flagged either — that is a deliberate rewrite, not a duplicate. No fix is offered: which definition to keep is a judgement call.

This rule is enabled by default.

The first calc is replaced before it is ever called:

r
calc <- function(x) {
  x + 1
}

calc <- function(x) {
  x * 2
}

calc(3)
text
warning: duplicated-function-definition
 --> example.R:5:1
  |
5 | calc <- function(x) {
  | ^^^^ function `calc` is redefined here; the definition on line 1 is never used
  = help: Remove the definition that is overwritten, or give one of them a different name.

The same mistake inside a function body:

r
process <- function(data) {
  clean <- function(x) x[!is.na(x)]
  clean <- function(x) x[x > 0]
  clean(data)
}
text
warning: duplicated-function-definition
 --> example.R:3:3
  |
3 |   clean <- function(x) x[x > 0]
  |   ^^^^^ function `clean` is redefined here; the definition on line 2 is never used
  = help: Remove the definition that is overwritten, or give one of them a different name.

Readability ​

true-false-symbol ​

Prefer the reserved literals TRUE/FALSE over the rebindable base symbols T/F.

T and F are ordinary base-R bindings, not reserved words—T <- FALSE is legal—so relying on them as boolean shorthand is fragile. The fix is withheld when the name resolves to a local binding, since that is the user's own variable rather than the shorthand.

This rule is enabled by default.

T and F used as boolean shorthand:

r
x <- T
y <- F
text
warning: true-false-symbol
 --> example.R:1:6
  |
1 | x <- T
  |      ^ use `TRUE` instead of `T`
  = help: `T`/`F` are rebindable; prefer the reserved literals.
warning: true-false-symbol
 --> example.R:2:6
  |
2 | y <- F
  |      ^ use `FALSE` instead of `F`
  = help: `T`/`F` are rebindable; prefer the reserved literals.

After applying the fix:

r
x <- TRUE
y <- FALSE

comparison-negation ​

Flag a negated comparison—!(a == b), !x < y—which reads more clearly as the opposite comparison (a != b, x >= y).

The fix is withheld when a comment in the operand would otherwise be lost.

This rule is enabled by default.

Negating an equality test:

r
if (!(a == b)) stop()
text
warning: comparison-negation
 --> example.R:1:5
  |
1 | if (!(a == b)) stop()
  |     ^^^^^^^^^ negated comparison is clearer as the opposite operator
  = help: Flip the comparison instead of negating it.

After applying the fix:

r
if (a != b) stop()

outer-negation ​

Flag any(!x)/all(!x), which by De Morgan's law read more clearly with the negation pulled outside: !all(x) and !any(x).

The rule fires only when every positional argument is negated (a na.rm argument is allowed and preserved). The fix is withheld when the call sits in a context that binds tighter than !, where the rewrite would need parentheses.

This rule is enabled by default.

Negating every element of an aggregation:

r
if (any(!ok)) stop()
text
warning: outer-negation
 --> example.R:1:5
  |
1 | if (any(!ok)) stop()
  |     ^^^^^^^^ negating an aggregation is clearer with the negation outside
  = help: `any(!x)` is `!all(x)`; `all(!x)` is `!any(x)`.

After applying the fix:

r
if (!all(ok)) stop()

string-boundary ​

Flag grepl("^abc", x) and grepl("abc$", x), single-anchored fixed-string matches that are the clearer startsWith(x, "abc") and endsWith(x, "abc")—they state the prefix/suffix test directly and skip regex compilation.

The rule fires only on the clean shape (two positional arguments, a one-end-anchored plain-literal pattern) and only when grepl resolves to base R. The fix is unsafe: on NA or non-character input startsWith/endsWith diverge from grepl (NA vs FALSE, an error vs coercion).

This rule is enabled by default.

Anchored fixed-string matches:

r
grepl("^abc", x)
text
warning: string-boundary
 --> example.R:1:1
  |
1 | grepl("^abc", x)
  | ^^^^^^^^^^^^^^^^ single-anchor `grepl()` is the clearer `startsWith()`
  = help: Use `startsWith()`.

unnecessary-nesting ​

Flag an if whose entire body is a second if—the two could be a single if with the conditions joined by &&, dropping a needless level of nesting. It fires only when neither if has an else (an else on either side changes what runs) and the inner if is the sole statement of the outer one.

The fix joins the conditions with &&, parenthesizing each non-primary condition so the grouping is preserved. It is unsafe (collapsing dedents the body, so a reformat may follow) and withheld when it would drop a comment.

This rule is enabled by default.

An if whose only body is another if can be a single if:

r
if (a) {
  if (b) {
    do_thing()
  }
}
text
warning: unnecessary-nesting
 --> example.R:2:3
  |
2 |   if (b) {
  |   ^^ this `if` is nested in another `if` with no `else`
  = help: Combine the two conditions with `&&` to drop a level of nesting.

cyclomatic-complexity ​

Report function bodies whose native CFG decision complexity exceeds [lint.rules.cyclomatic-complexity] max-complexity (20 by default, at least 1). This maintainability policy is opt-in and has no autofix.

The score starts at 1. Each reachable if, for, while, &&, or || adds 1. Each value-bearing arm of a base-resolved switch() adds 1, including an unnamed arm: a numeric selector can still match none. Empty fallthrough labels add nothing. else, return(), stop(), break, next, and unconditional repeat add nothing themselves. Decisions in nested functions are scored independently; formal defaults, quoted bodies, and unreachable tails are excluded. Decisions in ordinary call arguments count as potential flow, without assuming eager evaluation.

A simple loop or an early-return guard scores 2. These native scores intentionally differ from cyclocomp and Jarl, which score those shapes as 3. Consider splitting a complex function into smaller helpers.

This rule is disabled by default; enable it with select.

Many independent conditions make a function harder to maintain:

r
dispatch <- function(x) {
  if (x$a && x$b) a()
  if (x$c && x$d) b()
  if (x$e && x$f) c()
  if (x$g && x$h) d()
  if (x$i && x$j) e()
  if (x$k && x$l) f()
  if (x$m && x$n) g()
  if (x$o && x$p) h()
  if (x$q && x$r) i()
  if (x$s && x$t) j()
}
text
warning: cyclomatic-complexity
 --> example.R:1:13
  |
1 | dispatch <- function(x) {
  |             ^^^^^^^^ function has a cyclomatic complexity of 21, exceeding the maximum of 20
  = help: Split this function into smaller helpers.

Performance ​

any-is-na ​

Flag any(is.na(x)), which is the purpose-built anyNA(x)—faster (it short-circuits and builds no intermediate logical vector) and clearer.

The rule fires only on the clean single-argument shape and only when both any and is.na resolve to base R; a local redefinition of either is left alone.

This rule is enabled by default.

Testing for any missing value:

r
if (any(is.na(x))) stop()
text
warning: any-is-na
 --> example.R:1:5
  |
1 | if (any(is.na(x))) stop()
  |     ^^^^^^^^^^^^^ `any(is.na(x))` is the faster, clearer `anyNA(x)`
  = help: Use `anyNA(x)`.

After applying the fix:

r
if (anyNA(x)) stop()

any-duplicated ​

Flag any(duplicated(x)), which is the purpose-built anyDuplicated(x) > 0—faster (it short-circuits and builds no intermediate logical vector) and clearer.

The rule fires only on the clean single-argument shape and only when both any and duplicated resolve to base R; a local redefinition of either is left alone. Because the replacement is a comparison, the fix is withheld in a context that binds tighter than a comparison, where the bare rewrite would need parentheses.

This rule is enabled by default.

Testing for any duplicate value:

r
if (any(duplicated(x))) stop()
text
warning: any-duplicated
 --> example.R:1:5
  |
1 | if (any(duplicated(x))) stop()
  |     ^^^^^^^^^^^^^^^^^^ `any(duplicated(x))` is the faster, clearer `anyDuplicated(x) > 0`
  = help: Use `anyDuplicated(x) > 0`.

After applying the fix:

r
if (anyDuplicated(x) > 0) stop()

coalesce ​

Flag if (is.null(x)) y else x (and its mirror if (!is.null(x)) x else y), which is the null-coalescing x %||% y—shorter, and it evaluates x once instead of twice.

The rule fires only when is.null resolves to base R; a local redefinition is left alone. The fix is unsafe: %||% needs R >= 4.4 (or rlang), and collapsing the two evaluations of x changes behavior when x has side effects.

This rule is enabled by default.

Falling back to a default when a value is NULL:

r
y <- if (is.null(x)) default else x
text
warning: coalesce
 --> example.R:1:6
  |
1 | y <- if (is.null(x)) default else x
  |      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `if (is.null(x)) y else x` is the null-coalescing `x %||% y`
  = help: Use `x %||% y`.

crossprod ​

Flag t(x) %*% y and x %*% t(y), which are the purpose-built crossprod(x, y) and tcrossprod(x, y)—faster (they go straight to BLAS and never materialize the transpose that t() builds) and clearer.

The rule fires only when one operand is a single-argument t() call and that t resolves to base R; a local redefinition is left alone. When both operands are the same symbol the single-argument form (crossprod(x)) is used.

This rule is enabled by default.

Transposed matrix products:

r
a <- t(x) %*% y
b <- x %*% t(y)
text
warning: crossprod
 --> example.R:1:6
  |
1 | a <- t(x) %*% y
  |      ^^^^^^^^^^ `t(x) %*% y` is the faster, clearer `crossprod(x, y)`
  = help: Use `crossprod(x, y)`.
warning: crossprod
 --> example.R:2:6
  |
2 | b <- x %*% t(y)
  |      ^^^^^^^^^^ `x %*% t(y)` is the faster, clearer `tcrossprod(x, y)`
  = help: Use `tcrossprod(x, y)`.

After applying the fix:

r
a <- crossprod(x, y)
b <- tcrossprod(x, y)

lengths ​

Flag sapply(x, length), which is the purpose-built lengths(x)—faster (a single C pass instead of an R call per element) and clearer. Both return an integer vector and keep x's names by default.

The rule fires only on the clean two-positional-argument shape and only when sapply resolves to base R and length is not locally rebound; a redefinition of either is left alone.

This rule is enabled by default.

Per-element lengths of a list:

r
n <- sapply(x, length)
text
warning: lengths
 --> example.R:1:6
  |
1 | n <- sapply(x, length)
  |      ^^^^^^^^^^^^^^^^^ `sapply(x, length)` is the faster, clearer `lengths(x)`
  = help: Use `lengths(x)`.

After applying the fix:

r
n <- lengths(x)

nzchar ​

Flag comparisons of nchar(x) against zero—nchar(x) > 0, nchar(x) >= 1, nchar(x) != 0, and their mirrored and negated spellings—which are the purpose-built nzchar(x) (or !nzchar(x) for the empty test): faster, and it states the intent directly.

The rule fires only on the clean single-argument shape and only when nchar resolves to base R; a local redefinition is left alone. The fix is unsafe: on NA_character_ input nzchar yields TRUE where the nchar comparison yields NA (exact equivalence would need nzchar(x, keepNA = TRUE)).

This rule is enabled by default.

Testing for non-empty strings:

r
keep <- x[nchar(x) > 0]
text
warning: nzchar
 --> example.R:1:11
  |
1 | keep <- x[nchar(x) > 0]
  |           ^^^^^^^^^^^^ comparing `nchar()` to zero is the faster, clearer `nzchar()`
  = help: Use `nzchar(x)` for non-empty, `!nzchar(x)` for empty.

seq ​

Flag colon ranges from 1 up to a length—1:length(x), 1:nrow(x), or 1:n—which silently count down when that length is zero (1:0 is c(1L, 0L), not an empty sequence), a classic off-by-one bug for loops over possibly-empty input. seq_along(x) and seq_len(n) return a zero-length sequence instead, and agree with the colon form everywhere else.

The length/nrow/ncol/NROW/NCOL forms fire only when the callee resolves to base R; a redefinition is left alone. Literal ranges (1:10) and computed bounds (1:(n - 1)) are not flagged.

This rule is enabled by default.

Ranges over a vector's indices and up to a count:

r
for (i in 1:length(x)) print(x[i])
for (j in 1:n) f(j)
text
warning: seq
 --> example.R:1:11
  |
1 | for (i in 1:length(x)) print(x[i])
  |           ^^^^^^^^^^^ `1:length(x)` counts down (`1:0`) when the length is zero; `seq_along(x)` handles empty input
  = help: Use `seq_along(x)`.
warning: seq
 --> example.R:2:11
  |
2 | for (j in 1:n) f(j)
  |           ^^^ `1:n` counts down (`1:0`) when the length is zero; `seq_len(n)` handles empty input
  = help: Use `seq_len(n)`.

After applying the fix:

r
for (i in seq_along(x)) print(x[i])
for (j in seq_len(n)) f(j)

class-equals ​

Flag comparisons of class(x) against a string literal—class(x) == "cls", class(x) != "cls", and the %in% membership spellings—which are inherits(x, "cls") (or its negation): class() returns the whole class vector, so the comparison is elementwise (an error in an if () condition on a multi-class object) and misses subclasses, while inherits() asks the intended question directly without materializing the vector.

The rule fires only on the clean single-argument shape and only when class resolves to base R; a local redefinition is left alone. The fix is unsafe: on a multi-class object the comparison yields an elementwise vector where inherits() yields a scalar, and for S4 objects inherits() follows the formal inheritance chain.

This rule is enabled by default.

Testing an object's class:

r
if (class(x) == "factor") levels(x)
text
warning: class-equals
 --> example.R:1:5
  |
1 | if (class(x) == "factor") levels(x)
  |     ^^^^^^^^^^^^^^^^^^^^ comparing `class(x)` to a string is fragile—`class()` returns a vector; `inherits()` asks directly
  = help: Use `inherits(x, "cls")` (or `!inherits(x, "cls")`).

fixed-regex ​

Flag a base-R regex call (grepl, grep, sub, gsub, regexpr, gregexpr, regexec) whose pattern is a plain string literal with no regex metacharacter, and add fixed = TRUE—it skips regex compilation and states that the pattern is a literal.

The rule fires only when the callee resolves to base R and no fixed/ignore.case/perl argument is already present. Because a metacharacter-free pattern matches identically either way, the fix (inserting , fixed = TRUE) is safe.

This rule is enabled by default.

A literal pattern matched as a regex:

r
grepl("abc", x)
text
warning: fixed-regex
 --> example.R:1:7
  |
1 | grepl("abc", x)
  |       ^^^^^ `grepl()` with a literal pattern should use `fixed = TRUE`
  = help: Add `fixed = TRUE`.

After applying the fix:

r
grepl("abc", x, fixed = TRUE)

sort ​

Flag sort(x)[1], which sorts the whole vector just to read one extreme — the purpose-built min(x) (or max(x) for decreasing = TRUE) finds it in a single pass and states the intent directly.

The rule fires only on the clean shape — a [1] subset of a sort call with one positional argument and at most a literal decreasing flag — and only when sort resolves to base R; a local redefinition is left alone. The fix is unsafe: sort drops NAs by default while min/max propagate them (exact equivalence would need na.rm = TRUE), and on an empty vector sort(x)[1] is NA while min(x) warns and yields Inf.

This rule is enabled by default.

Reading one extreme off a full sort:

r
smallest <- sort(x)[1]
largest <- sort(x, decreasing = TRUE)[1]
text
warning: sort
 --> example.R:1:13
  |
1 | smallest <- sort(x)[1]
  |             ^^^^^^^^^^ `sort(x)[1]` sorts everything to read one extreme — use `min(x)`
  = help: Use `min(x)`.
warning: sort
 --> example.R:2:12
  |
2 | largest <- sort(x, decreasing = TRUE)[1]
  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `sort(x)[1]` sorts everything to read one extreme — use `max(x)`
  = help: Use `max(x)`.

matrix-apply ​

Flag apply(x, 1/2, sum/mean) when the corresponding rowSums, colSums, rowMeans, or colMeans call is clearer and faster. The exact supported argument shape and all relevant base names are verified before rewriting.

This rule is enabled by default.

Dedicated matrix row and column helpers:

r
totals <- apply(x, 1, sum)
text
warning: matrix-apply
 --> example.R:1:11
  |
1 | totals <- apply(x, 1, sum)
  |           ^^^^^^^^^^^^^^^^ Use `rowSums(x)` instead of this indirect base call.
  = help: Use `rowSums(x)`.

which-grepl ​

Flag which(grepl(pattern, x)), which makes two passes where grep(pattern, x) directly returns matching indices. Both calls must resolve to base R.

This rule is enabled by default.

Direct matching indices:

r
i <- which(grepl("^a", x))
text
warning: which-grepl
 --> example.R:1:6
  |
1 | i <- which(grepl("^a", x))
  |      ^^^^^^^^^^^^^^^^^^^^^ Use `grep(pattern, x)` instead of this indirect base call.
  = help: Use `grep(pattern, x)`.

After applying the fix:

r
i <- grep("^a", x)

rep-len ​

Flag the exact rep(x, length.out = n) shape, for which rep_len(x, n) is the direct base primitive. Calls with times, each, or other arguments are excluded.

This rule is enabled by default.

Direct length-limited repetition:

r
y <- rep(x, length.out = n)
text
warning: rep-len
 --> example.R:1:6
  |
1 | y <- rep(x, length.out = n)
  |      ^^^^^^^^^^^^^^^^^^^^^^ Use `rep_len(x, n)` instead of this indirect base call.
  = help: Use `rep_len(x, n)`.

After applying the fix:

r
y <- rep_len(x, n)

system-file ​

Flag redundant nesting of base file.path() and system.file(). system.file() already accepts path components through ..., so exact clean shapes can be flattened safely.

This rule is enabled by default.

Path components passed directly to system.file:

r
p <- system.file(file.path("a", "b"), package = "pkg")
text
warning: system-file
 --> example.R:1:6
  |
1 | p <- system.file(file.path("a", "b"), package = "pkg")
  |      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use `system.file(..., package = pkg)` instead of this indirect base call.
  = help: Use `system.file(..., package = pkg)`.

After applying the fix:

r
p <- system.file("a", "b", package = "pkg")

list2df ​

Flag do.call(cbind.data.frame, x) in favor of list2DF(x) on R 4.0 or newer; exact arguments and base resolution avoid changing recycling or dispatch behavior.

This rule is enabled by default.

A list converted directly to a data frame:

r
df <- do.call(cbind.data.frame, x)
text
warning: list2df
 --> example.R:1:7
  |
1 | df <- do.call(cbind.data.frame, x)
  |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use `list2DF(x)` instead of this indirect base call.
  = help: Use `list2DF(x)`.

length-levels ​

Flag length(levels(x)), for which base nlevels(x) expresses the intent directly. Both nested calls must resolve to base R.

This rule is enabled by default.

A factor's number of levels:

r
n <- length(levels(x))
text
warning: length-levels
 --> example.R:1:6
  |
1 | n <- length(levels(x))
  |      ^^^^^^^^^^^^^^^^^ Use `nlevels(x)` instead of this indirect base call.
  = help: Use `nlevels(x)`.

After applying the fix:

r
n <- nlevels(x)

boolean-arithmetic ​

Flag arithmetic existence tests such as length(which(p)) == 0 and sum(p, na.rm = TRUE) > 0 when any(p, na.rm = TRUE) states the intent more directly and avoids materializing indices or counting matches. Empty tests use !any(...); positive tests use any(...).

The rule recognizes comparisons against zero or one, including mirrored spellings. A sum() argument must be syntactically logical and use na.rm = TRUE; a bare sum(p) == 0 is left alone because sum() and any() differ when TRUE and NA coexist. Source calls must resolve to base R. The fix is unsafe because classed values can change Summary method dispatch.

This rule is enabled by default.

Testing whether any condition holds:

r
if (length(which(ok)) == 0) stop()
text
warning: boolean-arithmetic
 --> example.R:1:5
  |
1 | if (length(which(ok)) == 0) stop()
  |     ^^^^^^^^^^^^^^^^^^^^^^ counting logical values is less direct than `!any(...)`
  = help: Use `!any(...)` with `na.rm = TRUE`.

Documentation ​

roxygen-unknown-tag ​

Flag roxygen tags that roxygen2 does not understand.

roxygen2 warns on an unknown tag and drops it from the generated .Rd, so a misspelled tag (@exprot, @parma) silently loses documentation—or worse, an intended @export never reaches the NAMESPACE. Custom tags from extension roclets can be suppressed with # arity-lint skip roxygen-unknown-tag.

This rule is enabled by default.

A misspelled @export:

r
#' Add one
#' @exprot
add_one <- function(x) x + 1
text
warning: roxygen-unknown-tag
 --> example.R:2:4
  |
2 | #' @exprot
  |    ^^^^^^^ `@exprot` is not a tag roxygen2 understands
  = help: Check the spelling against the roxygen2 tag index; suppress with `# arity-lint skip roxygen-unknown-tag` for extension-roclet tags.

roxygen-title ​

Flag a documented function whose roxygen block has no title.

The first untagged paragraph (or an explicit @title) becomes the topic title; without one, roxygen2 warns and R CMD check rejects the generated .Rd. An @export with no documentation at all is flagged too—R CMD check reports it as an undocumented export. Blocks that merge into or inherit another topic (@rdname, @describeIn, @inherit*, @template) and @noRd blocks are skipped, and a block owning a topic is satisfied by a title on any block merging into it, anywhere in the package—the title belongs to the topic. An export-only block can also find its title in a topic listing its name as an alias. Skipped too is a bare @export on a function the package's NAMESPACE registers with S3method()—that generates no topic and no undocumented export.

This rule is enabled by default.

A documented, exported function with no title paragraph:

r
#' @param x A number.
#' @export
add_one <- function(x) x + 1
text
warning: roxygen-title
 --> example.R:1:1
  |
1 | #' @param x A number.
  | ^^ documentation block has no title
  = help: Add a leading prose line (the first paragraph becomes the title) or an explicit `@title`.

roxygen-return ​

Flag an @exported function documented without @return.

CRAN requires every exported function's documentation to describe its return value (the .Rd \value section); roxygen2 itself stays silent, so the omission otherwise surfaces only at submission time. @returns is accepted as an alias. @noRd blocks and blocks that merge into or inherit another topic (@rdname, @inherit, …) are skipped, and a block owning a topic is satisfied by a @return on any block merging into it, anywhere in the package—the \value section belongs to the topic. An export-only block can also find its value documentation in a topic listing its name as an alias. A titleless S3 method is skipped too (registered with S3method(), so it is not exported and generates no .Rd); the generic's topic owns the value.

This rule is enabled by default.

An exported function with no @return:

r
#' Add one
#' @param x A number.
#' @export
add_one <- function(x) x + 1
text
warning: roxygen-return
 --> example.R:3:4
  |
3 | #' @export
  |    ^^^^^^^ exported function is documented without `@return`
  = help: Add `@return` (or `@returns`) describing the value.

roxygen-param ​

Flag @param documentation that does not match the documented function.

Four shapes are reported: a formal argument with no @param, a @param naming a nonexistent formal (often a rename that never reached the docs), a name documented twice, and a @param missing its name or description. Coverage is judged against the generated topic, not the block: @rdname and @describeIn merge several functions into one .Rd, so a block owning a topic is judged against the union of every joiner's formals, anywhere in the package. Blocks that inherit documentation from another object (@inheritParams, @template, …) or that join a topic owned elsewhere are exempt from the coverage checks, and a titleless S3 method (registered with S3method(), so it generates no .Rd) is exempt from the missing-@param check; duplicates are always reported. Explicit @usage supplies the checked signatures. Export-only blocks can resolve documentation through aliases, but an alias alone adds no parameter requirements when its function is absent from the topic's usage. Unsupported usage does not hide missing documentation on independently known signatures.

This rule is enabled by default.

y is undocumented and @param z matches nothing:

r
#' Add two numbers
#' @param x The first number.
#' @param z The other one.
#' @export
add <- function(x, y) x + y
text
warning: roxygen-param
 --> example.R:3:11
  |
3 | #' @param z The other one.
  |           ^ `@param z` does not match a formal argument of the documented function
  = help: Rename it to a formal argument or remove it.
warning: roxygen-param
 --> example.R:5:20
  |
5 | add <- function(x, y) x + y
  |                    ^ formal argument `y` is not documented with `@param`
  = help: Add `@param` for it (or `@inheritParams` a function that documents it).

roxygen-examples ​

Flag @examples code that does not parse.

R CMD check runs example code, so a syntax error in an @examples section (or an @examplesIf condition) fails the package at check time. The embedded code is reparsed with arity's own parser and the first syntax error of each snippet is reported at its exact location in the comment. Rd wrappers like \dontrun{} are understood and their contents still checked.

This rule is enabled by default.

An unclosed call in the example:

r
#' Add one
#' @examples
#' add_one(1
#' @export
add_one <- function(x) x + 1
text
warning: roxygen-examples
 --> example.R:3:11
  |
3 | #' add_one(1
  |           ^ example code does not parse: expected ')' to close function call
  = help: `R CMD check` runs example code; fix the syntax error.

roxygen2-compat ​

Flag documentation constructs mismatched with the project's roxygen2 version.

The targeted version comes from [compat] roxygen2 in arity.toml, or from the package DESCRIPTION (Config/roxygen2/version, then the legacy RoxygenNote); without either, the rule stays silent. Targeting a version below 8.0.0 flags syntax only 8.0.0 understands—@prop, @R6method, `Rd expr` render-time code spans, @inheritParams argument filters (which older versions silently misread as argument names), and backtick-quoted names containing spaces. Targeting 8.0.0 or later flags a single-line tag (@rdname, @importFrom, …) whose value spans lines, which 8.0.0 warns about.

This rule is enabled by default.

An @inheritParams filter under a declared roxygen2 7.x (roxygen2 = "7.3.2" under [compat] in arity.toml):

r
#' Add one
#' @inheritParams other -verbose
add_one <- function(x) x + 1
text
warning: roxygen2-compat
 --> example.R:2:25
  |
2 | #' @inheritParams other -verbose
  |                         ^^^^^^^^ `@inheritParams` argument filters require roxygen2 >= 8.0.0; older versions silently misread them as argument names (this project targets 7.3.2)
  = help: Drop the filters or raise `[compat] roxygen2`.

Packaging ​

undeclared-dependency ​

Flag package code that reaches a package its DESCRIPTION never declares.

dplyr::filter() in R/ works on the author's machine because dplyr happens to be installed there; on a clean machine it is a load-time error, and R CMD check reports it. Declaring the dependency is what causes it to be installed, so leaving it out is a bug that only ever surfaces somewhere else.

The rule matches pkg::name, pkg:::name, and the package argument of library, require, requireNamespace, and loadNamespace—at any depth, since the conditional-dependency idiom lives inside a function body.

The exempt set is R's own: everything declared in any of Depends, Imports, Suggests, LinkingTo, or Enhances, the package's own name, and the packages R ships at base priority—except methods and stats4, which R CMD check still expects a package to declare. Only files directly in R/ are checked: a test's or a vignette's dependencies belong in Suggests, and R does not scan those directories for this check either.

There is no autofix. A fix is an edit to the file the finding is in, and the repair here is a line in DESCRIPTION.

This rule is enabled by default.

In R/ of a package whose DESCRIPTION declares only Imports: rlang:

r
summarize <- function(data) {
  dplyr::group_by(data, id)
}
text
warning: undeclared-dependency
 --> example.R:2:3
  |
2 |   dplyr::group_by(data, id)
  |   ^^^^^ package `dplyr` is used here but is not declared in DESCRIPTION
  = help: Add `dplyr` to `Imports:` in DESCRIPTION.

routine-registration ​

Flag string-named .Call, .C, .Fortran, and .External calls in package R sources. Prefer registered native symbols to runtime string lookup. A string still triggers the rule when the routine is registered: registration alone does not make the R call use the symbol binding.

Only files directly in a package's R/ directory are checked. Dynamic names and symbol arguments are left alone. Existing NAMESPACE and native registration facts supply symbol visibility through the project graph; the rule never runs R or inspects an installed package.

There is no automatic fix: the symbol's binding may depend on useDynLib() aliases or .fixes, and changing registration can require edits to NAMESPACE and native sources.

This rule is enabled by default.

In a package's R/ directory:

r
f <- function(x) .Call("native_fun", x)
text
warning: routine-registration
 --> example.R:1:24
  |
1 | f <- function(x) .Call("native_fun", x)
  |                        ^^^^^^^^^^^^ `.Call` looks up a native routine by string name
  = help: Register the native routine and pass its registered symbol binding.

description-missing-field ​

Flag a DESCRIPTION missing a field R requires.

R CMD build refuses a package whose DESCRIPTION omits Package, Version, Title, Description, Author, Maintainer, or License. Authors@R supplies Author through a named person with a role, and Maintainer through a single creator with a name and nonempty email. Computed values are left alone when derivation cannot be decided statically. A field that is present but empty declares nothing and counts as missing.

Every missing field is reported as one finding rather than one each: the defect is that the file is incomplete, and it takes one decision—and one suppression—to settle.

A file with no fields at all is left alone; that is not an incomplete package description.

There is no autofix: each of these fields needs a value only the author has.

This rule is enabled by default.

A DESCRIPTION that R CMD build would reject:

text
Package: mypkg
Version: 0.1.0
text
warning: description-missing-field
 --> DESCRIPTION:1:1
  |
1 | Package: mypkg
  | ^^^^^^^ DESCRIPTION is missing the required fields `Title`, `Description`, `Author`, `Maintainer`, `License`
  = help: Add the fields `Title`, `Description`, `Author`, `Maintainer`, `License`, or supply suitable people in `Authors@R` to derive `Author` and `Maintainer`.

description-duplicate-field ​

Flag a DESCRIPTION field declared more than once.

A repeated field is a silent mistake: nothing errors, and the last value quietly replaces the earlier value. Both arity and R's read.dcf apply that rule.

The finding is reported on the later occurrence, which is both the repeat and the value that takes effect. Duplicates are detected across DCF records, so a stray blank line does not hide one.

There is no autofix: removing a duplicate means choosing a value, and a fix would silently make that choice for the author.

This rule is enabled by default.

A field declared twice, with the later value silently taking effect:

text
Package: mypkg
Version: 0.1.0
License: MIT + file LICENSE
Version: 0.2.0
text
warning: description-duplicate-field
 --> DESCRIPTION:4:1
  |
4 | Version: 0.2.0
  | ^^^^^^^ `Version` is already declared on line 2; this later occurrence silently replaces its value
  = help: Keep one `Version` field and delete the other.

description-unknown-field ​

Flag a likely misspelling of a standard DESCRIPTION field.

This is deliberately a near-miss check rather than a whitelist: arbitrary fields, including Config/*, are legal. A name is reported only when it is one edit from a standard field, or when whitespace separates an otherwise standard name from its colon. R treats that whitespace as part of the name, so Package : mypkg declares Package rather than Package and is silently ignored.

There is no autofix: renaming a field changes the metadata R reads, so the author should confirm the intended spelling.

This rule is enabled by default.

A misspelled field that R silently ignores:

text
Package: mypkg
Version: 0.1.0
Suggest: testthat
text
warning: description-unknown-field
 --> DESCRIPTION:3:1
  |
3 | Suggest: testthat
  | ^^^^^^^ `Suggest` is not a standard DESCRIPTION field; did you mean `Suggests`?
  = help: Rename the field to `Suggests`.

description-version-constraint ​

Flag a dependency entry whose parenthesized part is not a version constraint or compares against an invalid version string.

R reads pkg (>= 1.0.0): an operator and a version. Anything else—dplyr (1.0.0), dplyr (>=), dplyr (latest)—states no bound at all, and R's dependency check enforces nothing. The line reads as a requirement and behaves as none, so the package installs against exactly the versions its author meant to exclude.

Checked in all five dependency fields, R included: Depends: R (>= 4.1) is the most common constraint in any DESCRIPTION. Versions must contain at least two runs of ASCII digits separated by dots or hyphens, such as 1.0 or 1.2-3. SVN revisions such as r12345 are allowed only for Depends: R. Values such as latest, v1.0, and 1..0 are invalid.

There is no autofix. dplyr (1.0.0) most likely means >=, but it could mean == or >, and guessing would invent a requirement the author never wrote.

This rule is enabled by default.

A version requirement R will not enforce:

text
Package: mypkg
Depends: R (4.1)
Imports: dplyr (1.0.0)
text
warning: description-version-constraint
 --> DESCRIPTION:2:10
  |
2 | Depends: R (4.1)
  |          ^^^^^^^ the version constraint on `R` states no bound, so R enforces nothing here
  = help: Write a comparison operator and a version, as in `(>= 1.0.0)`.
warning: description-version-constraint
 --> DESCRIPTION:3:10
  |
3 | Imports: dplyr (1.0.0)
  |          ^^^^^^^^^^^^^ the version constraint on `dplyr` states no bound, so R enforces nothing here
  = help: Write a comparison operator and a version, as in `(>= 1.0.0)`.

A comparison against an invalid version:

text
Package: mypkg
Imports: dplyr (>= latest)
text
warning: description-version-constraint
 --> DESCRIPTION:2:10
  |
2 | Imports: dplyr (>= latest)
  |          ^^^^^^^^^^^^^^^^^ the version constraint on `dplyr` uses an invalid version `latest`
  = help: Use a numeric version such as `1.0` or `1.2-3`.

description-package-in-multiple-fields ​

Flag a package listed in more than one of Depends, Imports, Suggests, and Enhances.

Writing R Extensions says a package should be listed in only one of these fields. They are a choice, not an accumulation, and every pair contradicts itself: Imports plus Suggests declares the package both required and optional, Depends plus Imports both attached and not. R settles it by picking one field, so the second declaration is inert, and R CMD check reports the pair.

LinkingTo is deliberately excluded. A package that supplies headers and R code belongs in both LinkingTo and Imports—the Rcpp idiom—and R's own check leaves it out of the comparison for the same reason. R is excluded too: it names the language, not a package.

The finding sits on the later listing, and names the field holding the earlier one. There is no autofix: which field to keep is a decision about whether the code may rely on the package at all.

This rule is enabled by default.

A package declared as both a hard requirement and an optional one:

text
Package: mypkg
Version: 0.1.0
Imports: dplyr, rlang
Suggests: dplyr, testthat
text
warning: description-package-in-multiple-fields
 --> DESCRIPTION:4:11
  |
4 | Suggests: dplyr, testthat
  |           ^^^^^ `dplyr` is already listed in `Imports`; a package belongs in only one dependency field
  = help: List `dplyr` in either `Imports` or `Suggests`, and delete the other entry.

description-malformed-name ​

Flag a Package value R will not accept as a package name.

R's valid_package_name is [[:alpha:]][[:alnum:].]*[[:alnum:]]: a letter, then letters, digits, and periods, ending in a letter or digit. So underscores, hyphens, and a leading period are all out, and a name is at least two characters long—except the literal R, which R's check spells out as an alternative.

A Package naming one of the packages R itself ships (stats, utils, methods, …) is reported too, since that package could never be installed alongside the one R ships. A description declaring Priority: base is exempt, which is how the base packages name themselves.

The letter and digit classes are matched as Unicode, exactly as R matches them under a UTF-8 locale, so café is accepted—a stricter reading would report a defect R CMD check does not have.

An absent or empty Package is description-missing-field's finding, not this one's.

There is no autofix: the name is also in the NAMESPACE, the file names, the tests, and every pkg:: that reaches the package, so renaming is the author's.

This rule is enabled by default.

A name R's valid_package_name rejects, since underscores are not name characters:

text
Package: my_pkg
Version: 0.1.0
text
warning: description-malformed-name
 --> DESCRIPTION:1:10
  |
1 | Package: my_pkg
  |          ^^^^^^ `my_pkg` is not a valid package name: R requires a letter, then letters, digits, and periods, ending in a letter or digit
  = help: Rename the package: at least two characters, starting with a letter, ending in a letter or digit, and made of letters, digits, and periods.

A name R already ships:

text
Package: stats
Version: 0.1.0
text
warning: description-malformed-name
 --> DESCRIPTION:1:10
  |
1 | Package: stats
  |          ^^^^^ `stats` is the name of a base R package
  = help: Rename the package to one R does not already ship.

description-malformed-version ​

Flag a Version value R or CRAN will object to.

R's valid_package_version is ([[:digit:]]+[.-]){1,}[[:digit:]]+: runs of digits joined by . or -. The trailing run is written separately from the repeated group, so a version has at least two components—a bare Version: 1 is one R rejects, and so is any component that is not digits (1.0.0-beta, v1.0).

Two CRAN pretest NOTEs are reported by the same rule, since the repair is the same: a component with a leading zero (1.01, which sorts before 1.1 as text and equal to it as a version), and an implausibly large component (1234 or more). Calendar versioning is exempt from both, exactly as CRAN exempts it: 2026.01 keeps its zero, and a four-digit component that reads as a year is not an absurd one.

The digit class is matched as ASCII, exactly as R matches it under a UTF-8 locale—note that this is the opposite of description-malformed-name, whose letter class is Unicode there. A description declaring Priority: base is exempt, since a base package's version is R's own to spell.

An absent or empty Version is description-missing-field's finding, not this one's.

There is no autofix: which number a release carries is a decision about the release, and it is also in the package's tags, its NEWS.md, and every constraint a dependent puts on it.

This rule is enabled by default.

A version R's valid_package_version rejects, since a component has to be digits:

text
Package: mypkg
Version: 1.0.0-beta
text
warning: description-malformed-version
 --> DESCRIPTION:2:10
  |
2 | Version: 1.0.0-beta
  |          ^^^^^^^^^^ `1.0.0-beta` is not a valid package version: R requires runs of digits joined by `.` or `-`
  = help: Renumber the release: at least two components, each one digits, separated by `.` or `-`.

A component with a leading zero, which sorts one way as text and another as a version:

text
Package: mypkg
Version: 1.01
text
warning: description-malformed-version
 --> DESCRIPTION:2:10
  |
2 | Version: 1.01
  |          ^^^^ `1.01` has a component with a leading zero
  = help: Drop the leading zero: `1.01` and `1.1` are the same version to R, but not to anything that sorts the text.

A component too large to be a release number:

text
Package: mypkg
Version: 1.0.5000
text
warning: description-malformed-version
 --> DESCRIPTION:2:10
  |
2 | Version: 1.0.5000
  |          ^^^^^^^^ `1.0.5000` has an implausibly large component (`5000`)
  = help: Check the number: a component of 1234 or more is usually a typo or a date in the wrong slot.

description-malformed-maintainer ​

Flag a Maintainer value R or CRAN will object to.

R's .valid_maintainer_field_regexp wants exactly one Name <address>, or the literal ORPHANED. A missing address (Maintainer: Jane Doe) is the common case and fails it outright.

Three CRAN pretest checks cover the rest of the field and are reported by the same rule, since they are one conversation about who maintains the package: text after the address, which is what two maintainers look like (R's own regexp accepts those, so this is the clause that catches them); an address with no name in front of it; and a comma in an unquoted display name, which reads as a list of people—"Doe, Jane" <jane@example.com> is the repair.

R's regexp is ported as written and deliberately not tightened to RFC 5322: a quoted local part, a domain with no TLD, and a domain label starting with - are all addresses R CMD check accepts. A Maintainer wrapped across continuation lines is accepted too, exactly as R accepts it.

An absent or empty Maintainer is not this rule's finding: R derives one from Authors@R, and whether the package names a maintainer at all is description-missing-field's subject.

There is no autofix: an address cannot be invented, a name cannot be invented, and whether a comma separates a surname from a given name or separates two people is a question only the author can answer.

This rule is enabled by default.

A maintainer with no address, which is what R's .valid_maintainer_field_regexp mostly catches:

text
Package: mypkg
Version: 0.1.0
Maintainer: Jane Doe
text
warning: description-malformed-maintainer
 --> DESCRIPTION:3:13
  |
3 | Maintainer: Jane Doe
  |             ^^^^^^^^ `Jane Doe` has no email address
  = help: Add the maintainer's address: `Name <name@example.com>`, or `ORPHANED` if the package has no maintainer.

Two maintainers, where R's Maintainer holds exactly one:

text
Package: mypkg
Version: 0.1.0
Maintainer: Jane Doe <jane@example.com>, John Roe <john@example.org>
text
warning: description-malformed-maintainer
 --> DESCRIPTION:3:13
  |
3 | Maintainer: Jane Doe <jane@example.com>, John Roe <john@example.org>
  |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Jane Doe <jane@example.com>, John Roe <john@example.org>` names more than one person
  = help: Name one maintainer here and credit everyone else in `Authors@R`: R's `Maintainer` is the single person to write to.

A comma in an unquoted display name, which reads as a list of people:

text
Package: mypkg
Version: 0.1.0
Maintainer: Doe, Jane <jane@example.com>
text
warning: description-malformed-maintainer
 --> DESCRIPTION:3:13
  |
3 | Maintainer: Doe, Jane <jane@example.com>
  |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the maintainer name `Doe, Jane` contains a comma but is not quoted
  = help: Quote the name (`"Doe, Jane" <jane@example.com>`), so the comma does not read as a second maintainer.

description-title-format ​

Check the package Title field: it must occupy one physical line, contain at most 65 Unicode characters, and avoid a trailing period unless R's et al. or space-prefixed ... exception applies. R accepts those exceptions anywhere in the title.

The title must not equal the package name or begin with that name followed by a space or colon (case-insensitively), matching CRAN's redundancy check. The usethis placeholder What the package does... must be replaced. These findings are report-only because choosing title wording requires the author's judgment.

This rule is enabled by default.

A title ending in a period:

text
Package: mypkg
Title: Model Fitting.
text
warning: description-title-format
 --> DESCRIPTION:2:21
  |
2 | Title: Model Fitting.
  |                     ^ the `Title` field must not end in a period

A title repeating the package name:

text
Package: mypkg
Title: mypkg: Model Fitting
text
warning: description-title-format
 --> DESCRIPTION:2:8
  |
2 | Title: mypkg: Model Fitting
  |        ^^^^^^^^^^^^^^^^^^^^ the `Title` field redundantly repeats the package name

description-text-format ​

Check the package Description field against R's sentence-level and CRAN's lexical conventions. The text must begin with a capital and end in ., !, or ? (optionally followed by one quote or closing parenthesis). It must not begin by repeating the package name or Title, or with This package, Functions for, The package, A package, In this package, or In the package.

Single-quoted function identifiers such as 'case_when()' are flagged too. Write function names without single quotes.

HTTP(S) URLs, doi:10.../... references, and recognizable arXiv: identifiers must be enclosed in angle brackets, with no whitespace after the colon. Arity safely wraps an unambiguous bare reference. All prose changes and quote removal are report-only because they require the author's judgment.

This rule is enabled by default.

Boilerplate prose, a quoted function identifier, and a missing final period:

text
Package: mypkg
Title: Model Fitting
Description: This package calls 'fit_model()'
text
warning: description-text-format
 --> DESCRIPTION:3:14
  |
3 | Description: This package calls 'fit_model()'
  |              ^^^^^^^^^^^^ the `Description` field must not start with `This package`
  = help: Start with a concise statement of what the package does.
warning: description-text-format
 --> DESCRIPTION:3:33
  |
3 | Description: This package calls 'fit_model()'
  |                                 ^^^^^^^^^^^^^ the function identifier `fit_model()` must not be single-quoted
  = help: Write it as `fit_model()` without quotes.
warning: description-text-format
 --> DESCRIPTION:3:44
  |
3 | Description: This package calls 'fit_model()'
  |                                            ^ the `Description` field must end with `.`, `!`, or `?`
  = help: End the description with sentence punctuation.

A bare URL, for which arity can safely add angle brackets:

text
Package: mypkg
Title: Model Fitting
Description: See https://example.com for details.
text
warning: description-text-format
 --> DESCRIPTION:3:18
  |
3 | Description: See https://example.com for details.
  |                  ^^^^^^^^^^^^^^^^^^^ the reference `https://example.com` must be enclosed in angle brackets
  = help: Write it as `<https://example.com>`.

After applying the fix:

text
Package: mypkg
Title: Model Fitting
Description: See <https://example.com> for details.

description-date-format ​

Require the optional Date field to contain a valid calendar date in ISO 8601 yyyy-mm-dd form, with a four-digit year from 0000 to 9999, a two-digit month, and a two-digit day. Check month lengths and leap years as well as spelling. Missing or empty values are ignored.

The date's age and whether it lies in the future are deliberately unchecked: lint results must not change overnight without an edit. No autofix is offered because choosing the intended date requires the author.

This rule is enabled by default.

A date with an ambiguous order:

text
Package: mypkg
Date: 09/11/2026
text
warning: description-date-format
 --> DESCRIPTION:2:7
  |
2 | Date: 09/11/2026
  |       ^^^^^^^^^^ `Date` must be a valid calendar date in `yyyy-mm-dd` form
  = help: Write the intended date with a four-digit year and two-digit month and day.

description-license ​

Validate License against R's bundled license database. Accept license names and abbreviations, supported versions and version restrictions, | alternatives, + file LICENSE or + file LICENCE, standalone file pointers, and Unlimited. Version restrictions must select at least one version in the database. Missing or empty fields are left to description-missing-field.

Exact legacy spellings from R's standardization table, such as GPL 2.0, have a safe fix when their replacement is valid. Other unknown or malformed components have no autofix because choosing a license requires the author. This rule checks the specification, not license file existence, file contents, or whether additional terms are legally permitted.

This rule is enabled by default.

An exact legacy spelling with a standard replacement:

text
Package: mypkg
License: GPL 2.0
text
warning: description-license
 --> DESCRIPTION:2:10
  |
2 | License: GPL 2.0
  |          ^^^^^^^ `GPL 2.0` is a nonstandard license specification
  = help: Use `GPL-2`.

After applying the fix:

text
Package: mypkg
License: GPL-2

A version restriction that selects no known license:

text
Package: mypkg
License: GPL (>= 99)
text
warning: description-license
 --> DESCRIPTION:2:10
  |
2 | License: GPL (>= 99)
  |          ^^^^^^^^^^^ `GPL (>= 99)` is not a valid R license specification
  = help: Use a license specification from R's license database or a `file LICENSE` pointer.

description-encoding ​

Flag text outside R's ISO-8859 byte set in a DESCRIPTION with no Encoding field, and non-ASCII text in fields R requires to be ASCII: Package, Version, License, and Encoding.

A missing declaration has a safe fix: arity only lints text it has already decoded as UTF-8, so it can append Encoding: UTF-8 without guessing. Non-ASCII content in an ASCII-only field has no autofix because choosing replacement text requires the author.

This rule is enabled by default.

A package containing UTF-8 text without declaring its encoding:

text
Package: mypkg
Version: 0.1.0
Title: A 日本語 package
License: MIT
text
warning: description-encoding
 --> DESCRIPTION:3:10
  |
3 | Title: A 日本語 package
  |          ^^ DESCRIPTION contains text that requires an encoding declaration
  = help: Add `Encoding: UTF-8`.

After applying the fix:

text
Package: mypkg
Version: 0.1.0
Title: A 日本語 package
License: MIT
Encoding: UTF-8

description-authors-at-r ​

Flag an Authors@R field R will not read the way its author meant it.

R CMD build derives Author and Maintainer from this field, and the derivation is exacting: it needs a person with the cre role, a non-empty name, and an email. Without one it errors out—"Authors@R field gives no person with maintainer role, valid email address and non-empty name"—so person("Jane", "Doe", role = c("aut", "cre")) is a package that does not build. When no explicit Maintainer field overrides it, R also checks the derived maintainer's address against its email regexp. The creator's first nonempty email supplies that address; malformed literal addresses are reported here.

The rest of R's .check_package_description_authors_at_R_field is reported by the same rule: a field that is not R, or that holds a call R refuses to evaluate (only person, as.person, c, list, paste, and paste0 are allowed); a person with no name or no role, who is credited nowhere at all; a role outside the MARC relator table, which person() silently drops; more than one cre, where R stores exactly one maintainer; and a malformed or duplicated ORCID iD or ROR ID. Both identifiers are self-validating—an ORCID carries a MOD 11-2 check digit—so no network is involved.

Two checks on the neighboring Author field are here for the same reason, since both are Authors@R content written under the wrong key: a value that begins with the field header Author:, and a value that is a person(...) or c(...) call, which R stores verbatim and never evaluates.

Nothing is evaluated. The value is parsed with arity's own R parser and resolved only as far as literal text goes; a computed argument resolves to unknown and every finding that depends on it is withheld, so the rule reports strictly less than R CMD check does and never more.

There is no autofix: an email, a name, a role, and a check digit are all facts about a person that only that person has.

This rule is enabled by default.

A creator with no email, which is what R needs to derive a Maintainer and refuses to build without:

text
Package: mypkg
Version: 0.1.0
Authors@R: person("Jane", "Doe", role = c("aut", "cre"))
text
warning: description-authors-at-r
 --> DESCRIPTION:3:12
  |
3 | Authors@R: person("Jane", "Doe", role = c("aut", "cre"))
  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the package's `cre` has no email address, so R can derive no `Maintainer`
  = help: Add `email = "name@example.com"`. `R CMD build` needs a `cre` with a name and an address, and errors out without one.

A creator whose email produces a malformed Maintainer:

text
Package: mypkg
Version: 0.1.0
Authors@R: person("Jane", "Doe", role = c("aut", "cre"), email = "invalid")
text
warning: description-authors-at-r
 --> DESCRIPTION:3:66
  |
3 | Authors@R: person("Jane", "Doe", role = c("aut", "cre"), email = "invalid")
  |                                                                  ^^^^^^^^^ `invalid` is a malformed email address for the derived `Maintainer`
  = help: Supply an address R accepts, such as `email = "name@example.com"`. R uses the creator's first nonempty email to derive `Maintainer`.

A person credited nowhere, because person() drops anyone with no role:

text
Package: mypkg
Version: 0.1.0
Authors@R: c(
    person("Jane", "Doe", , "jane@example.com", c("aut", "cre")),
    person("John", "Roe")
  )
text
warning: description-authors-at-r
 --> DESCRIPTION:5:5
  |
5 |     person("John", "Roe")
  |     ^^^^^^^^^^^^^^^^^^^^^ this person has no role, so R credits them nowhere
  = help: Add a `role`, such as `"aut"` for an author or `"ctb"` for a contributor: `person()` drops anyone with no role from `Author`.

An ORCID iD whose MOD 11-2 check digit does not add up:

text
Package: mypkg
Version: 0.1.0
Authors@R: person("Jane", "Doe", , "jane@example.com", c("aut", "cre"),
    comment = c(ORCID = "0000-0002-1825-0098"))
text
warning: description-authors-at-r
 --> DESCRIPTION:4:25
  |
4 |     comment = c(ORCID = "0000-0002-1825-0098"))
  |                         ^^^^^^^^^^^^^^^^^^^^^ `0000-0002-1825-0098` is not a valid ORCID iD
  = help: An ORCID iD is `0000-0002-1825-0097` and carries a check digit, so a mistyped one is decidable without asking orcid.org.

R code under the Author key, which R stores as a plain string and never evaluates:

text
Package: mypkg
Version: 0.1.0
Author: person("Jane", "Doe", role = c("aut", "cre"))
text
warning: description-authors-at-r
 --> DESCRIPTION:3:9
  |
3 | Author: person("Jane", "Doe", role = c("aut", "cre"))
  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `person("Jane", "Doe", role = c("aut", "cre"))` is R code under the `Author` key
  = help: Move the call to `Authors@R`, which R evaluates. `Author` is a plain string R prints as written, brackets and quotes included.

description-empty-person ​

Flag a person() in Authors@R that supplies no arguments.

person()—and person(NULL), which takes the same early return—is a zero-length person vector, not a nameless person. R concatenates it away without a word: c(person("Jane", …), person()) is a one-element vector, Author and Maintainer derive exactly as they would have, and nothing in R CMD check will ever mention it.

So this is style rather than correctness. The call is a contributor someone opened and never filled in, left in shipped metadata where it reads as an intention—and it is invisible to every tool that reads the field unless one looks for it.

It is a rule of its own rather than a clause of description-authors-at-r because it is the one packaging finding R CMD check does not back, and keeping the ids apart keeps that rule's claim exact—as well as letting this one be suppressed on its own.

A person carrying anything at all is a person, however little R can make of them: person(role = "ctb") and even person("") are description-authors-at-r's subject, not this rule's. A computed argument could be NULL and could be a name, so the rule stays silent there.

There is no autofix: deleting the call means deleting a comma that belongs to its neighbor, and filling the person in is the author's.

This rule is enabled by default.

A contributor opened and never filled in. R drops the call silently, so the credit was never going to appear:

text
Package: mypkg
Version: 0.1.0
Authors@R: c(
    person("Jane", "Doe", , "jane@example.com", c("aut", "cre")),
    person()
  )
text
warning: description-empty-person
 --> DESCRIPTION:5:5
  |
5 |     person()
  |     ^^^^^^^^ this `person()` supplies nothing, so it names nobody
  = help: Fill the person in, or delete the call: R reads `person()` as a zero-length person vector and drops it silently.

description-authors-at-r-required ​

Flag a DESCRIPTION without an Authors@R field.

Writing R Extensions requires this field for CRAN submissions, even when valid Author and Maintainer fields are present. This rule is off by default because packages need not target CRAN. Enable it with --select description-authors-at-r-required.

description-missing-field checks R's required metadata independently. A present Authors@R field, even an empty or invalid one, is left to description-authors-at-r to validate. Files with no fields are left alone.

There is no autofix: contributor names, roles, and contact details require the author's input.

This rule is disabled by default; enable it with select.

Legacy author fields satisfy R, but CRAN also requires Authors@R:

text
Package: mypkg
Version: 0.1.0
Title: A Test Package
Description: Demonstrate package metadata checks.
License: GPL-3
Author: Jane Doe [aut, cre]
Maintainer: Jane Doe <jane@example.com>
text
warning: description-authors-at-r-required
 --> DESCRIPTION:1:1
  |
1 | Package: mypkg
  | ^^^^^^^ CRAN submissions require an `Authors@R` field
  = help: Add `Authors@R` with the package's contributors and their roles.

description-title-case ​

Check English package titles against R's tools::toTitleCase(), with CRAN's additional exemption for single-quoted software names. R's stopwords, technical terms, mixed-case names, and capitalization after punctuation determine the suggested title.

This rule is off by default because technical names and editorial choices often need exceptions. Enable it with --select description-title-case. It checks titles when Language is absent, en, or starts with en-. Missing or empty titles and titles equal to the package name are left to other rules, matching CRAN's gating.

There is no autofix: the author must decide which capitalization suits the package and its software names.

This rule is disabled by default; enable it with select.

Capitalize principal words while preserving stopwords:

text
Package: mypkg
Title: Statistical methods for data analysis
text
warning: description-title-case
 --> DESCRIPTION:2:8
  |
2 | Title: Statistical methods for data analysis
  |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the `Title` field should use English title case
  = help: Consider: Statistical Methods for Data Analysis

Preserve the spelling of quoted software names:

text
Package: mypkg
Title: fitting models with 'mixed-effects software'
text
warning: description-title-case
 --> DESCRIPTION:2:8
  |
2 | Title: fitting models with 'mixed-effects software'
  |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the `Title` field should use English title case
  = help: Consider: Fitting Models with 'mixed-effects software'

description-collate-mismatch ​

Flag Collate specifications that repeat a filename, name an ineligible or nonexistent R source, or omit an eligible source file. R rejects these specifications during installation.

Unix and Windows are checked separately. Collate.unix and Collate.windows override Collate on their respective platforms. Each list must include the eligible files directly in R/ and in that platform's subdirectory. Filenames must start with an ASCII letter or digit and end in .R, .r, .S, .s, or .q. Quoted filenames may contain spaces.

The rule uses a disk inventory independent of Collate and stays silent when that inventory is unavailable, including standalone in-memory buffers. Files generated by configure must exist before linting the specification.

There is no autofix: adding a missing file requires choosing its execution order.

This rule is enabled by default.

In a package with R/a.R and R/b.R:

text
Package: mypkg
Version: 0.1.0
Collate: 'a.R' 'missing.R' 'a.R'
text
warning: description-collate-mismatch
 --> DESCRIPTION:3:1
  |
3 | Collate: 'a.R' 'missing.R' 'a.R'
  | ^^^^^^^ R source `b.R` is missing from `Collate` (Unix and Windows)
warning: description-collate-mismatch
 --> DESCRIPTION:3:16
  |
3 | Collate: 'a.R' 'missing.R' 'a.R'
  |                ^^^^^^^^^^^ `missing.R` in `Collate` does not name an eligible R source (Unix and Windows)
warning: description-collate-mismatch
 --> DESCRIPTION:3:28
  |
3 | Collate: 'a.R' 'missing.R' 'a.R'
  |                            ^^^^^ `a.R` is listed more than once in `Collate` (Unix and Windows)

unused-dependency ​

Flag an Imports: entry that nothing in the package reaches.

An Imports entry promises that installing this package installs that one, so an entry no code reaches costs every user a download, a build, and a constraint to satisfy for nothing. R CMD check reports it too.

A package counts as reached by pkg::, pkg:::, a library, require, requireNamespace, or loadNamespace call at any depth, a NAMESPACE import()/importFrom()/importClassesFrom()/importMethodsFrom(), or a roxygen @import/@importFrom tag. Exempt on top of that: anything also in LinkingTo (the Rcpp skeleton), methods when the package defines an S4 or reference class, and any package whose name appears as a plain string (a dynamic do.call("::", …) or system.file(package = …)).

Only Imports is checked. Depends is an API decision the package's own code may never name; Suggests is for tests, vignettes, and examples, reached from outside the package's own code; LinkingTo and Enhances are invisible to R-source analysis.

Usage is folded over every R file the run analyzed under the package root, so a package reached only from tests/, inst/, or data-raw/ counts as used when those files are in the run (arity lint .) and is reported when they are not (arity lint R/). A vignette's R code is never analyzed either way, so a dependency used only there is reported—it belongs in Suggests.

It reports on absence, and a wrong finding would have a maintainer delete a dependency their package needs, so it stays silent unless the run analyzed the package's whole R/ source set and read its NAMESPACE—which is also why it is off by default.

There is no autofix: removing an entry from a comma-separated list is not a local edit, and this is not a claim a tool should act on destructively.

This rule is disabled by default; enable it with select.

In a package whose only R source is f <- function() rlang::abort("no"):

text
Package: mypkg
Version: 0.1.0
Imports: rlang, tibble
text
warning: unused-dependency
 --> DESCRIPTION:3:17
  |
3 | Imports: rlang, tibble
  |                 ^^^^^^ `tibble` is declared in `Imports:` but nothing in the package uses it
  = help: Remove `tibble` from `Imports:`, or move it to `Suggests:` if only tests, vignettes, or examples need it.

Meta ​

misnamed-suppression ​

Flags an # arity directive that names a rule arity does not ship, or that does not parse as a directive at all (an unknown verb, a missing one, a rule named where the form takes none). Either way it suppresses nothing, and does so silently — the failure mode of a suppression is that no output appears, which is also what success looks like. When exactly one shipped rule ID is an unambiguous near-match, the fix rewrites the ID and leaves the reason text alone; otherwise the finding is report-only. Note that syntax-error is not a lint rule: parse errors are reported before any rule runs and cannot be suppressed.

This rule is enabled by default.

The rule ID is misspelled, so the directive suppresses nothing:

r
# arity-lint skip unusd-binding: leftover from a refactor
x <- 1
text
warning: misnamed-suppression
 --> example.R:1:19
  |
1 | # arity-lint skip unusd-binding: leftover from a refactor
  |                   ^^^^^^^^^^^^^ `unusd-binding` is not an arity lint rule, so this directive suppresses nothing
  = help: did you mean `unused-binding`?

After applying the fix:

r
# arity-lint skip unused-binding: leftover from a refactor
x <- 1

A comma-separated list is not supported — write one directive per rule:

r
# arity-lint skip browser, repeat: debugging
x <- 1
text
warning: misnamed-suppression
 --> example.R:1:19
  |
1 | # arity-lint skip browser, repeat: debugging
  |                   ^^^^^^^^ `browser,` is not an arity lint rule, so this directive suppresses nothing
  = help: a directive names one rule; write a separate `# arity-lint skip` per rule

blanket-suppression ​

Flags an # arity-lint directive that names no rule where it could have. # arity-lint skip-file: <reason> disables every rule for the file, and # arity-lint off: <reason> does so until the matching on — including every rule arity ships in the future, so the code quietly stops being checked as the rule set grows. A directive with nothing after the verb is the opposite failure: it names nothing, so it suppresses nothing. Both are fixed by naming the rule. Not flagged: the rule-scoped # arity-lint skip-file <rule>, broad in range but narrow in effect, and # arity skip: <reason>, broad in rules but bounded to one statement. Report-only — choosing the rules for the author would guess at intent in either direction.

This rule is enabled by default.

Disabling every rule for the file, including rules that do not exist yet:

r
# arity-lint skip-file: generated by a script
x <- 1
text
warning: blanket-suppression
 --> example.R:1:1
  |
1 | # arity-lint skip-file: generated by a script
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this directive disables every lint rule for the whole file
  = help: scope it with `# arity-lint skip-file <rule>: <reason>`

A directive with no rule ID suppresses nothing at all:

r
# arity-lint skip
x <- 1
text
warning: blanket-suppression
 --> example.R:1:1
  |
1 | # arity-lint skip
  | ^^^^^^^^^^^^^^^^^ this directive names no rule, so it suppresses nothing
  = help: name the rule: `# arity-lint skip <rule>: <reason>`

misplaced-suppression ​

Flags an # arity directive written where it can never take effect. A # arity-format directive is honored in statement lists — the top level and a block body — because that is where the formatter can splice source back verbatim; between two call arguments it marks nothing. An # arity-lint on with no open region closes nothing, which usually means its off was written with a different prefix (# arity off and # arity-lint off are separate regions). Both fail silently: a directive that does nothing looks exactly like one that worked. Report-only — moving the comment would mean guessing which statement the author meant.

This rule is enabled by default.

The formatter acts on whole statements, so a directive between two arguments marks nothing:

r
f(
  a = 1,
  # arity-format skip: hand-aligned
  b = 2
)
text
warning: misplaced-suppression
 --> example.R:3:3
  |
3 |   # arity-format skip: hand-aligned
  |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the formatter ignores a directive here; it acts on whole statements
  = help: move it above the statement, at the top level or in a block body

An on closes only a region opened with the same prefix, so this one closes nothing:

r
# arity off
x <- 1
# arity-lint on
y <- 2
text
warning: misplaced-suppression
 --> example.R:3:1
  |
3 | # arity-lint on
  | ^^^^^^^^^^^^^^^ this `on` closes no open region, so it does nothing
  = help: open one first, with the same prefix: `# arity-lint off <rule>: <reason>`

deprecated-suppression ​

Flags # arity-ignore and # arity-ignore-file, the spellings the linter shipped with, and rewrites them to # arity-lint skip and # arity-lint skip-file. Both still parse and behave identically, so nothing is broken and nothing changes when the fix is applied — this is a migration aid, so that a codebase reaches one spelling before the aliases are removed. The fix is Safe and replaces the prefix alone: the rule ID, the reason, and the author's spacing are left exactly as written. Directives in a DESCRIPTION are not covered, as with every meta rule.

This rule is enabled by default.

The shipped spelling of # arity-lint skip:

r
# arity-ignore unused-binding: part of the documented API
config <- list(width = 80)
text
warning: deprecated-suppression
 --> example.R:1:3
  |
1 | # arity-ignore unused-binding: part of the documented API
  |   ^^^^^^^^^^^^ this spelling is deprecated; it means `# arity-lint skip`
  = help: write `# arity-lint skip` instead

After applying the fix:

r
# arity-lint skip unused-binding: part of the documented API
config <- list(width = 80)

…and of # arity-lint skip-file:

r
# arity-ignore-file unused-binding: generated by tools/codegen.R
x <- 1
text
warning: deprecated-suppression
 --> example.R:1:3
  |
1 | # arity-ignore-file unused-binding: generated by tools/codegen.R
  |   ^^^^^^^^^^^^^^^^^ this spelling is deprecated; it means `# arity-lint skip-file`
  = help: write `# arity-lint skip-file` instead

After applying the fix:

r
# arity-lint skip-file unused-binding: generated by tools/codegen.R
x <- 1

unexplained-suppression ​

Flags an # arity directive that carries no reason — the text after the :. Telling a tool to stand down is a standing claim that it is wrong at this spot, and without a reason the next reader cannot tell a considered exception from noise someone silenced under deadline, so it becomes permanent by default. An # arity-lint on is exempt: it closes a region whose off already gave the reason. Disabled by default, since requiring reasons is a house style rather than a defect; enable it with select. Report-only: writing the reason is the fix, and inventing one would fabricate a justification.

This rule is disabled by default; enable it with select.

The directive says what to silence, but not why:

r
# arity-lint skip unused-binding
x <- 1
text
warning: unexplained-suppression
 --> example.R:1:1
  |
1 | # arity-lint skip unused-binding
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this suppression gives no reason
  = help: add one after the rule: `# arity-lint skip <rule>: <reason>`

outdated-suppression ​

Flags an # arity-lint directive that suppressed nothing on this run — the code it was written for has changed, but the directive stayed. A stale suppression is misleading (it asserts arity is wrong at a spot where arity says nothing) and it is a trap: it will silence a real finding if the shape ever comes back. The fix deletes the directive.

To avoid reporting a directive that is merely dormant, the rule only fires when the rule the directive names actually ran — a rule excluded by select/ignore, or one that is off by default, leaves its directives alone — or when the directive is dangling, with no code after it to attach to. Directives naming no rule are left to blanket-suppression, and unknown rule IDs to misnamed-suppression.

This rule is enabled by default.

x is read, so unused-binding finds nothing and the directive is dead:

r
# arity-lint skip unused-binding: no longer needed
x <- 1
print(x)
text
warning: outdated-suppression
 --> example.R:1:1
  |
1 | # arity-lint skip unused-binding: no longer needed
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `unused-binding` reports nothing here; this suppression is no longer needed

After applying the fix:

r
x <- 1
print(x)