Changelog ​
0.31.0 (2026-11-16) ​
Features ​
- lint: add
per-file-ignoresconfiguration (c672776)
Bug Fixes ​
- project: model source destination environments (
41d02be) - project: count qualified uses across packages (
c3f49f7) - project: resolve
source()paths from execution roots (9faade3) - semantic: recognize
.Random.seedafter RNG initialization (ffab761) - lint: resolve tinytest runner bindings (
dd15985) - format: align integrations with expanded function bodies (
e2524fe) - lint: flag
seq(length(x))for possibly empty input (3f5036d) - cli: emit empty JSON arrays for clean lint runs (
fee3435) - cli: resolve configuration per input directory (
fbcf8f1) - deps: update rustix for sound xattr handling (
9e34347), fixes #184 - ci: build musl releases with Zig (
d836100)
Dependencies ​
- updated crates/arity-formatter to v0.9.0
0.30.0 (2026-11-10) ​
Features ​
- lsp: add symbol signatures and containers (
12b8191) - lsp: complete DESCRIPTION field names (
054dbc5) - symbols: prune archived CRAN packages (
b252428) - lint: add
description-collate-mismatch(415ad24) - lint: add
description-title-caserule (06515f5) - lint: add opt-in
Authors@Rrequirement (aaea683) - lint: add
description-licenserule (8026be0) - lint: add description date format rule (
341c3a9) - lint: add
description-title-formatrule (45a1925)
Bug Fixes ​
- lint: validate derived maintainer addresses (
5b3d4b6) - lint: validate dependency version strings (
e04e648) - ci: update Cargo dependencies from workspace root (
600b0a0) - wasm: clone only string diagnostic getters (
99608a2) - roxygen: resolve manual aliases and usage (
67f55bc)
Dependencies ​
- updated crates/arity-formatter to v0.8.4
- updated crates/arity-parser to v0.8.0
0.29.0 (2026-10-30) ​
Features ​
- lint: add list-comparison rule (
78a7685)
Bug Fixes ​
- test: avoid stdin race in config conflict test (
9b5547e) - lint: resolve required fields from
Authors@R(6f3dac1) - lint: preserve topic owner parameter coverage (
6f9b131)
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 ​
- cli: support Rd files in
parse(d450a06) - lsp: enable workspace features from Rd buffers (
9733d28), ref #170
Bug Fixes ​
- ci: preserve Rd oracle fixture line endings (
5e8b02b)
Dependencies ​
- updated crates/arity-formatter to v0.8.3
- updated crates/arity-parser to v0.7.0
0.27.0 (2026-10-25) ​
Features ​
- lint: add
cyclomatic-complexityrule (64a35a7) - lint: add
strings-as-factorsrule (df3e9a1) - lint: add
routine-registrationrule (8c06bd7) - lint: add
terminal-close(f9163b8) - lint: add
confusable-identifier(b2ac2fc)
Bug Fixes ​
- deps: update vulnerable TLS dependencies (
a91f8e7), fixes #166 and #167 - update rustls to 0.23.46 (
1df1015)
Dependencies ​
- updated crates/arity-formatter to v0.8.2
- updated crates/arity-parser to v0.6.2
0.26.0 (2026-10-13) ​
Features ​
- lint: suggest nearby visible symbol names (
c445867) - lint: add
extend-selectoption (5a880b2) - lint: warn on partial argument matches (
968b026) - lint: warn on nonportable
sprintfpadding (5c94173) - lint: flag bare return statements (
752d442)
Bug Fixes ​
- lint: detect rejected trailing argument holes (
53fd077) - lint: resolve quoted data bindings (
87c08cb)
Dependencies ​
- updated crates/arity-formatter to v0.8.1
0.25.0 (2026-10-05) ​
Features ​
- docs: negotiate Markdown responses (
88e5208) - config: add
extendto extend configurations (ee7c1d0) - format: expose roxygen setting (
6a22dc4), refs #149
Bug Fixes ​
- lint: clarify repeated title diagnostic (
fcfd29f)
Performance Improvements ​
- lsp: cache document symbols until the next edit (
f40b177) - lsp: prune document symbol traversal (
6938781) - lsp: reuse cached document analysis (
d73fa44)
Dependencies ​
- updated crates/arity-formatter to v0.8.0
- updated crates/arity-parser to v0.6.1
0.24.0 (2026-09-25) ​
Features ​
Bug Fixes ​
- deps: update salsa to 0.28.5 (
ad953c3) - lsp: discard queued lints for closed descriptions (
3b3264c) - lint: attach skips to the next argument (
4cd65a4) - deps: bump rustls (
d4b93f9) - discovery: honor excludes through symlinked roots (
a5efd8e)
Performance Improvements ​
- build: enable ThinLTO with one codegen unit (
4c3457c)
0.23.0 (2026-09-07) ​
Features ​
- lint: add boolean-arithmetic rule (
da1045b) - parser: expose function formals (
9333512) - rindex: use typed NAMESPACE syntax (
677902e) - config: publish schema (
7180652) - lint: add description text format rule (
080b46c)
Bug Fixes ​
- bump
rust-versionto 1.89 and CI job (6683330)
Dependencies ​
- updated crates/arity-formatter to v0.7.1
- updated crates/arity-parser to v0.6.0
0.22.0 (2026-08-31) ​
Features ​
- verify formatter preserves syntax (
b144f7d)
Bug Fixes ​
- formatter: preserve else after comments (
bdf224d), fixes #129 - formatter: ignore comment trailing whitespace (
4d924d0), fixes #128 - formatter: keep bare if consequences (
bd63cc8), fixes #125 - formatter: preserve comment order (
44626da), fixes #123
Dependencies ​
- updated crates/arity-formatter to v0.7.0
- updated crates/arity-parser to v0.5.3
0.21.0 (2026-08-26) ​
Features ​
- format: report outdated directives (
eaa48e2) - lsp: refresh cached config (
6d82ca0) - format: align trailing comments (
58d854c)
Bug Fixes ​
- lint: gate local promise arguments (
2ec3e8b) - format: preserve commas before comments (
d529b97), closes #117
Performance Improvements ​
- lint: reuse analyzed source for rendering (
6cab16e)
Dependencies ​
- updated crates/arity-formatter to v0.6.0
0.20.0 (2026-08-21) ​
Features ​
- lint: add description encoding rule (
f4f0ba3) - lint: flag unknown DESCRIPTION fields (
1f52925) - roxygen: honor projector markdown default (
533fc49) - lint: add pipe-return rule (
18ab02a) - lint: add base call rewrites (
a04dd36) - lint: flag assignments in return (
72f7a77) - lint: add all-equal rule (
eebc4f7) - lint: add sprintf rule (
a04b37c) - lint: add rep-times-ignored rule (
efcf3ca) - lint: add missing-argument rule (
594d564) - lint: detect NaN and NULL comparisons (
88da964)
Bug Fixes ​
- lsp: skip discovery on unchanged membership reseed (
9c92a00) - lsp: complete dependency names without faulting index in (
b31b7db) - lsp: reload package index on cache root or meta change (
79a86c3) - rindex: derive package views from a single read (
92608d5) - lsp: stop leaking project snapshots per metadata change (
8cf322f), fixes #116 - lsp: record query log only during observation (
9959129) - parser: match read.dcf duplicate lookup (
55f7b68) - parser: match read.dcf empty-line folding (
7ce1789) - lint: recognize string-based reads (
b2b7a23), closes #115 - parser: span ordinary roxygen comments (
592a5fe) - lint: address future corpus false positives (
5615b43)
Performance Improvements ​
- lsp: load package index lazily, once per cache root (
de39edf) - format: bound formatting line diffs (
c3f9bc5)
Dependencies ​
- updated crates/arity-formatter to v0.5.0
- updated crates/arity-parser to v0.5.2
0.19.1 (2026-08-17) ​
Bug Fixes ​
- roxygen: classify Rd block macros by name (
49f2f40), closes #106 - accept non-ASCII letters in syntactic R names (
2c29b2f), refs #108
Performance Improvements ​
- linter: seed the project scope once, not per document (
f12344c) - project: share the per-file facts instead of copying them twice (
ebb1d4f) - linter: hand the salsa database teardown to the pool (
210f8fc) - linter: read the prologue's files in parallel (
938367b) - project: stop reading DESCRIPTION twice per package root (
262e460) - project: walk to a package root once per directory (
7b75a3c) - project: share one NAMESPACE's sets across a package's members (
21d1738) - project: answer the file-set relations from one shared member set (
2777621) - project: derive visibility from shared layers, not per-member sets (
36005a0) - project: fold a package clique once, not per ordered pair (
e1ecf4e) - linter: warm every fold input before the parallel passes (
6c0ee06) - lsp,incremental: verify edit slices without applying them (
7654bbd) - text,lsp: back document text with Arc<str> (
e80c63a) - rindex: load the lint index lazily, per package (
f472c69) - linter: find a directive's comment by offset (
0151f48)
Dependencies ​
- updated crates/arity-formatter to v0.4.1
- updated crates/arity-parser to v0.5.1
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 ​
- deps: bump
rowanto 0.17 (64ad43b)
Features ​
- lint: add deprecated-suppression (
41c37c0) - lint: add region directives and lint the new forms (
fdd1e5e) - lsp: send line-scoped formatting edits (
406b5ab) - lsp: add inlay hints for DESCRIPTION deps (
7aa282a) - lint: add
description-empty-person(41c7786) - lint: add
description-authors-at-r(21c4597) - lint: add
description-malformed-maintainer(f813cb5) - lint: add
description-malformed-version(31fcb76) - lint: add
description-malformed-name(3347825) - lint: add
description-package-in-multiple-fields(41cd5af) - format package DESCRIPTION files (#104) (
40583bf) - lsp: hover a DESCRIPTION dependency (
5655f64) - lsp: complete package names in DESCRIPTION dependency fields (
76f339f) - lsp: make an open DESCRIPTION authoritative in salsa (
2537f39) - lsp: publish DESCRIPTION diagnostics (
9b433a5) - lsp: route DESCRIPTION documents away from the R pipeline (
23a61fc) - linter: add unused-dependency (
b6d73cf) - linter: add undeclared-dependency (
d35c7fc) - linter: add three DESCRIPTION rules (
7ac50e4) - linter: discover and lint DESCRIPTION files (
18c9366) - linter: add a rule trait for the DCF grammar (
f3779d5) - rindex: treat declared dependencies as referenced (
256d4c8) - project: defer the import(pkg) verdict to the library index (
6f580bf) - project: resolve against declared Depends (
d999290) - incremental: make DESCRIPTION a salsa input (
3340923) - parser: add a lossless DCF CST parser (
42ca268) - lsp: widen call hierarchy edge attribution (
00a798d) - formatter: honor skip-file in a DESCRIPTION (
f737e8b) - formatter: honor arity-format directives (
922813c) - parser: record a directive's prefix range (
72d8536) - parser: add the shared arity directive grammar (
39651b0) - ast: add
RoxygenTag::value_text(5b35b6d) - parser: re-export the dependency-field helpers from dcf (
fbb8183) - dcf: parse structured dependency entries (
e5ee844) - vscode: gate inlay hints on the feature toggle (
dd6fde8) - code: claim DESCRIPTION for the language server (
0fe3077)
Bug Fixes ​
- linter: skip
coalescein the%||%definition (2114c88) - semantic: mark every def a closure read reaches (
32e98e2) - semantic: resolve names bound by
useDynLib(c72462a) - semantic: make defusing operators unquote-aware (
dd2ce0a) - roxygen: read projector topic names whole (
f7b6d3e) - lint: resolve roxygen topics across the package (
7e6e7ce) - lint: exempt S3 methods from
unused-binding(a107859) - lint: judge roxygen topics, not single blocks (
3357e83) - cli: give
lint --fixthe project scope (85d6d1e) - lint: skip
roxygen-paramon@noRdblocks (0b842d9) - semantic: mask the
.External2routine name (c090566) - semantic: never bind the walrus operator (
d1251b9) - semantic: match backticked names to NAMESPACE (
078d0e0) - lint: name the actual range in
seqmessages (5d4cbab) - lint: skip roxygen topic rules on S3 methods (
029af86) - lsp: refresh the graph when a DESCRIPTION disappears (
f987130) - linter: skip a fixture package's DESCRIPTION when walking (
0d70adb) - semantic: resolve backtick-quoted names (
cc3d1db) - rindex: keep only the packages import() names (
205957c) - formatter: give an Rd
\itemits own line (481b9ac) - formatter: flush a block Rd macro's opener line (
bd27d5c)
Performance Improvements ​
- linter: keep the standalone attach set lazy (
a238d64) - lsp: invalidate package metadata by path (
629ac9c) - formatter: answer both prepasses in one green-tree walk (
6f8a444)
Dependencies ​
- updated crates/arity-formatter to v0.4.0
- updated crates/arity-parser to v0.5.0
0.18.0 (2026-08-11) ​
Features ​
- cli: read stdin from
-, not a bare terminal (ae70cbb) - text: add TextBuffer pairing text with its line index (
bff3617) - text: patch the line index across an edit (
06c10c5) - semantic: mask data.table subsets, gate masking verbs (
aa7a8aa) - lsp: support folder renames (
00151ee) - parser: make brace-less system Rd macros sticky (
aed2df0) - parser: stop unknown Rd macros consuming a group (
374879e) - parser: expose an
is_single_expressionpredicate (93cae60)
Bug Fixes ​
- lsp: drop file renames that leave the workspace scope (
237daea) - lsp: follow a renamed workspace root through a rename (
1de3fb2) - roxygen: keep a trailing
;in a code span as\code(a1fcff9), closes #99 - formatter: keep blank line after a comment (
e50f7fe)
Performance Improvements ​
- lsp: answer position reads off the shared index (
e53de52) - lsp: answer whole-document reads off the shared index (
a354814) - lsp: thread the shared buffer into the lint request (
9b610a0) - text: scan for line starts with memchr (
6aa8b3b)
Dependencies ​
- updated crates/arity-formatter to v0.3.1
- updated crates/arity-parser to v0.4.0
0.17.0 (2026-08-07) ​
Features ​
- parser: let Rd macros win over literal backticks (
c9a88c4) - parser: model zero-arity Rd user macros (
884448e) - parser: model per-macro Rd argument arity (
b0b3f34) - roxygen: expand R system Rd user macros (
4867f69) - parser: model md blocks in block-macro bodies (
26aaa75) - parser: model multi-line Rd macro arguments (
b3b88e4) - roxygen: collapse within-block same-head sections (
104da98) - roxygen: project block-form verbatim macro bodies per-line (
c5e5f8b) - parser: model
\eqnand\deqnoptional second argument (3051dd4) - roxygen: model demoted md code spans via fragile gating (
30f0127) - roxygen: model parse_Rd brace recovery for kept md sections (
6121854) - lint: add
r-compatandroxygen2-compatrules (9098185) - config: add
[compat]minimum-version floors (4152c80) - roxygen: model roxygen2 8.0.0 grammar additions (
501180c) - roxygen: track roxygen2 8.0.0 as the parity oracle (
925411f) - linter: add
outdated-suppression(e017cbf) - linter: add
unexplained-suppression(b84eea9) - linter: add
blanket-suppression(cba661e) - linter: add
misnamed-suppression(404baa7) - linter: add
duplicated-function-definition(f3ec2fc) - linter: add
unused-function(740bf81) - linter: add
internal-function(6632b06) - cli: suppress
format --checkdiff under--quiet(3865fb0) - linter: add
for-loop-index/for-loop-dup-index(e75efad) - linter: add
download-file(bea9893) - linter: add per-rule config and
undesirable-function(4f7a112) - formatter: classify
@propand@R6methodtags (a0e81d0) - parser: model block-macro tails and adjacent second arg groups (
f7413a7) - parser: model parse_Rd verbatim args and Rd fragment reparse (
903f500) - parser: roxygen2 8.0.0 tag grammar (
f6d3647) - vscode: add per-feature enable toggles (
e8370b0)
Bug Fixes ​
- roxygen: treat a wide tag separator as prose (
d9f6a1b), closes #96 - formatter: keep marker-less remainder after a block macro (
40a89cb) - parser: fold deep-indented block starts into an open paragraph (
72ef2f1)
Dependencies ​
- updated crates/arity-formatter to v0.3.0
- updated crates/arity-parser to v0.3.0
0.16.0 (2026-08-06) ​
Features ​
- lsp: thread roxygen markdown default through salsa and lint (
6bd4801) - format: honor package roxygen markdown default (
5606f61) - project: discover roxygen markdown default statically (
be86db1) - rindex: opt-in
search()-diff attach probe (deecf3e) - rindex: capture attach sets at harvest (
4c6e7d8) - lint: gate undefined-symbol on harvested attach sets (
ed92f87) - rindex: resolve members from harvested attach sets (
492cfd0) - rindex: add
attachesto the index schema (731c4db) - formatter: re-export
rowanfor embedders (81a8d02) - formatter: options-taking
format_with_optionsentry (76ab583) - formatter: add serde and schema features (
341e173) - parser: caller-set roxygen markdown default (
6367b0b), closes #94
Bug Fixes ​
- lsp: expand meta-package members in
packages_to_build(a5b7466) - linter: simulate R argument matching for model-frame calls (
7eb78e0)
Dependencies ​
- updated crates/arity-formatter to v0.2.0
- updated crates/arity-parser to v0.2.0
0.15.0 (2026-08-05) ​
Features ​
- build: add installation scripts (
b620c58) - linter: mask model-frame args in
undefined-symbol(1fef3ea) - lsp: make nested functions call-hierarchy items (
5e3eb7f) - lsp: trigger signature help on
=(1021a4b) - linter: add
unnecessary-nestingrule (501f451) - lint: add implicit-assignment rule (
64a3f5e) - lint: add empty-assignment rule (
77efa97) - lsp: thread precise edits into span mapping (
09101b9) - lsp: thread precise edits into incremental reparse (
78ce7d1) - lsp: use incremental text document sync (
0e4b9ce) - linter: cut undefined-symbol FPs from opaque binders (
e1e5264) - linter: add
coalescerule (b7ac1d9) - linter: add browser rule (
fe7a5ba) - linter: add if-always-true rule (
96c136a) - semantic: add per-region control-flow graph (
a912b3c) - lsp: sharpen references/rename off def-use edges (
6204c54) - format: cache already-formatted files for --check (
acc46fc) - lsp: content-derived pull resultId (
f7ecb99) - lsp: negotiate positionEncoding (UTF-8) (
7a9af95) - lsp: work-done progress for background jobs (
12fa210) - lsp: static
$/@completion + label details (a5b72b8)
Bug Fixes ​
- npm: fall back to musl when glibc build fails (
f45beb7) - linter: withhold unused-binding fix on chain (
b3d42f6) - linter: cut unused-binding FPs from lazy reads (
17dbaf8) - linter: skip non-UTF-8 files instead of aborting (
89bacc4) - formatter: handle mid-line roxygen as trailing comment (
41140fa) - formatter: flatten binary chains with lhs-trailing comment (
ab99d52) - formatter: handle roxygen comment on assignment rhs (
0e29c0e), closes #89 - formatter: handle comment trailing binary lhs (
6953947) - parser: left-associate extract ops with postfix (
29c7416) - linter: resolve for-body reads in enclosing frame (
023cc57) - linter: close three undefined-symbol gaps (
9b4634d) - parser: group loose roxygen in arg lists (
f22b0e6) - parser: continue exprs across newlines in brackets (
c603475) - lexer: accept all raw string delimiter forms (
178dca1) - parser: continue expr across trailing comment in brackets (
31b23ea)
0.14.0 (2026-07-30) ​
Features ​
- semantic: add def-use reverse index (
89c8ab4) - lsp: react to on-disk changes via didChangeWatchedFiles (
3fa343b) - ci: add smoke-test-triage skill, sharpen corpus scan (#80) (
bb8906e) - lsp: add request cancellation and stale-read gating (
9f0d51a) - lsp: guard threads against handler panics (
1b0e329) - formatter: treat trailing comments as zero-width (
cd38a47) - roxygen: merge same-
@nameblocks into one topic (31df16a) - roxygen: drop blocks past the last top-level expr (
a7a264b) - roxygen: knitr chunk fence class carries the language (
85fbb37) - roxygen: newline ends unquoted html attribute value (
af07249) - roxygen: demote md image after odd backslash run (
579414b) - roxygen: inline-link destination crosses soft breaks (
78b7f79) - roxygen: raw fence info string can drop the section (
ef21a51) - roxygen: demote md macro after odd backslash run (
85cc88d) - roxygen: block-level reparse of leaked linkref defs (
ab90044) - roxygen: escaped-close link labels and markdown leak parsing (
41df574) - roxygen: link-ref defs inside block quotes (
27dbbe3) - roxygen: same-line HTML block in a list item (
122b450) - roxygen: field-edge Unicode trim and fence-info entities (
2fdc85c) - roxygen: setext column gate and per-piece rdComplete drop (
8e095f5) - roxygen: thematic-break block edges (
c6c011d) - roxygen: code-span backtick runs and
\verbfallback (965049e) - roxygen: consume link-ref defs inside list items (
25400f6) - parser: same-line code fence in a list item (
e51a6c9) - roxygen: strip setext-title link defs, field-wide refmap (
3f197dd) - roxygen: model roxygen2's trailing-empty-heading raw fallback (
4e2bb91) - parser: expand tabs to 4-column stops in roxygen markdown (
df95b3a) - parser: headings inside list items with in-list H1 hoist (
82e8c32) - parser: block quote opening on a list-marker line (
6fb3838) - parser: list-item content-indent start conditions (
56c1aec) - parser: nest same-line consecutive list markers (
531664b) - parser: list siblings pair by CommonMark indent window (
aa8f33f) - lint: add
sortrule (de7de18)
Bug Fixes ​
- formatter: don't let a paren's trailing comment eat the ')' (
5df242d) - formatter: don't let an if-branch trailing comment force a break (
86846c4), closes #70 - parser: don't bind an operator to a comment atom (
4856f9d), closes #71 - formatter: brace both if branches when a comment braces one (
d65d573), closes #73 - formatter: lay out a comment before an assignment RHS (
0f722b3) - formatter: measure breaks at the real column (#82) (
82e83fe), closes #67 - config: tolerate a missing anchor in discovery (#81) (
c627e2f) - parser: reject juxtaposed statements, fix two lexer gaps (#79) (
e98b877), closes #68 - guard force-exclude paths by
has_root(0a87100)
0.13.0 (2026-07-20) ​
Features ​
- cli: add
--force-excludefor explicit paths (0b600ca) - parser: link-reference definitions parse at the block level (
86b4a9d) - parser: reference-image resolution parity (
3504005) - parser: autolink span wins over the bracket carve (
787bcbb) - parser: refmap-aware reference-link chain pairing (
bf519eb) - parser: escaped open bracket is link-label content (
7a03ad1) - parser: invalid link-ref labels never define or link (
ebc4dd4) - parser: cmark-parity link-ref label normalization (
e0893d2) - parser: cmark-parity inline link destinations (
27f7b5e) - parser: block quote laziness state and xml_text flatten (
e5f03aa) - parser: block quote folds into a markdown list item (
3a37044) - parser: collapsed reference links under roxygen @md (
6bc059e) - parser: tilde code fences and CommonMark closer matching (
06b0b46)
0.12.0 (2026-07-11) ​
Features ​
- lint: add
is-numericandclass-equalsrules (b3c8443) - lint: add
seqrule (d3cf745) - lint: add
nzcharrule (e903216) - lint: add
lengthsrule (94b8f67) - bench: add linter and project benchmarks (
9852172) - roxygen: split fenced code body into per-line VERBs (
5f27595) - parser: resolve user-defined markdown image refs (
aa59fd4) - docs: add benchmark page with plots (
e17bcf9) - parser: resolve shortcut and reference markdown images (
9c0f625) - parser: drop section on trailing-backslash link dest (
355f6c8) - parser: reject invalid inline link destinations (
3054434) - roxygen: drop inline link title from href destination (
b34e06d) - parser: fold setext underline into block quote lazily (
2d40e13) - parser: fold block Rd macro into list item under
@md(27caa31) - parser: fold GFM table into list item under
@md(5cb6589) - rindex: harvest lazy-data symbols (
5f35fab) - ast: add Expr union and HasArgList trait (
6c11cf5) - ast: add AstToken layer and complete node wrappers (
9167928) - parser: fold indented code block into list item (
c22ae83) - parser: fold fenced code block into list item (
bf274b3)
Bug Fixes ​
- parser: make operator lexing UTF-8-safe (
2e5e9d9) - roxygen: don't markdown-process code-tag bodies under @md (
ceb0dba) - parser: flag stray closing delimiter at top level (
51f3023) - formatter: honor line-ending in format_range (
5800f16)
Performance Improvements ​
- use mimalloc as the global allocator (
fb60bf0) - lint: parallelize project lint over salsa db clones (
820ca43) - rindex: load lint index names-only and in parallel (
915bd80) - semantic: index scope bindings by name (
bccb478) - project: bucket top-level events in one model pass (
c9f668a) - lint: render pretty snippets from a line window (
11a4558)
0.11.0 (2026-07-08) ​
Features ​
- linter: add string-boundary and fixed-regex rules (
bddd07b) - linter: add crossprod rule for %*% with t() (
de48640) - parser: fold blank-separated list item paragraphs (
92772ce) - parser: split roxygen md lists on no-blank marker-type change (
f65195d) - lsp: add document color support (
3f8b048) - lsp: add selection ranges (
43dd077) - lsp: add roxygen skeleton code action (
8cac459) - lsp: add type hierarchy for S4/R6/RefClass (
b4c3133) - lsp: add document link support (
b0f5a92) - roxygen: project sticky brace-less RCODE/VERB swallow (
917fca5) - roxygen: project brace-less
\itemas UNKNOWN node (0b3f1cf) - roxygen: group bare braces in md heading titles as LIST (
a479f00) - roxygen: group bare braces in macro args as Rd LIST (
1143364) - config: honor excludes in LSP, sibling, and index walks (
66e7680) - parser: reparse non-braced top-level statements (
81124a5) - roxygen: project md bare brace groups as Rd LIST (
9edfcfa) - roxygen: project bare prose brace groups as Rd LIST (
0e2cbd7) - parser: gate in-arg macro carve on backslash parity (
b5fa27f) - roxygen: resolve Rd-string escapes in macro args (
8d08c7a) - roxygen: render md escaped braces bare in TEXT (
146da14) - roxygen: drop brace-less known Rd macros in projection (
3eba086) - parser: parity-gate Rd macro carves on backslash runs (
ba1a9e0) - parser: resolve multi-line code spans in the inline pass (
c3575f5) - parser: resolve multi-line inline HTML in the inline pass (
62ca1f3) - parser: merge blank-separated same-type markdown lists (
164d519) - parser: fold lazy continuations into markdown list items (
54f56f9) - linter: add roxygen documentation rules (
167ae38) - ast: add roxygen tag and prose accessors (
792ec6b) - parser: block quote, thematic break from tag value (
ff3f647)
Bug Fixes ​
- formatter: indent nested operand of binary chain (
ef14a99) - roxygen: keep md section on trailing % swallow (
4425971) - roxygen: resolve multi-backslash md brace runs at cmark stage (
756aacd) - roxygen: keep fragile-macro escaped braces in md drop scan (
0674bc7) - roxygen: scan raw text for md-off rdComplete drop (
f291ab1) - formatter: bail folded roxygen tags on structured lines (
b251e40) - formatter: reflow roxygen prose containing pipes (
6b17cad)
0.10.0 (2026-07-05) ​
Features ​
- parser: markdown block starts from same-line tag value (
62e976c) - parser: markdown HTML block from same-line tag value (
f343419) - parser: markdown HTML block condition 7 (
1d6c837) - parser: inline markdown HTML comment, PI, decl, CDATA (
b1b08b9) - parser: markdown HTML block conditions 2-5 under @md (
04819f4)
Bug Fixes ​
- formatter: break associative binary chains uniformly (
2c32f0a) - lint: sort rendered diagnostics by source offset (
950d223) - lint: surface parse errors instead of swallowing them (
9afb39f)
0.9.0 (2026-07-04) ​
Features ​
- parser: markdown HTML block condition 1 under @md (
dcc35a2) - parser: markdown indented code blocks under @md (
9308021) - parser: setext heading from same-line tag value (
6725dbe) - parser: fold block-quote lazy continuation lines (
d3d5583)
0.8.0 (2026-07-02) ​
Features ​
- roxygen: glue block-quote text onto adjacent prose (
8410550) - parser: recognize single-dash setext H2 underlines (
b6a56bf) - parser: recognize
@mdthematic breaks (176cd31) - parser: recognize
@mdblock quotes (f1b02aa) - parser: recognize
@mdsetext headings (b630a8e) - parser: hoist @md ATX headings into \section/\subsection (
55bf690) - parser: recognize GFM tables in @md prose (
89d9ec4) - parser: recognize CommonMark email autolinks (
bb988c8) - parser: reject link-ref def with trailing content (
1a728f5) - parser: decode HTML entities in @md prose (
9c8828e) - parser: fold prose tag continuation into the tag (
7179469) - parser: swallow @md prose percent comments (
4c03eea) - formatter: canonicalize roxygen tag layout by class (
bc9f3cb) - formatter: hang list Rd macros under prose tags (
6b1d6a4) - parser: collapse @md prose backslash runs (
a0cf8a7) - parser: emphasis span crosses inline Rd macro (
b282810) - parser: emphasis across nested macro in structural md arg (
ab7ab90) - parser: markdown in structural Rd macro args (
7808c50) - parser: pure-macro link displays drop/keep, not literal
[](65eea34) - parser: markdown in non-fragile Rd macro args (
e337667) - parser: backslash words in markdown link displays (
e303a9d) - roxygen: multi-line and entity-decoded link-ref defs (
02e1a15) - roxygen: whole-field link-ref poisoning demotion (
5d43db3) - roxygen: whole-field refmap for in-list undefined links (
a31927c) - roxygen: resolve user link-refs across list items (
798783a) - roxygen: run full link-ref pipeline in @section arm (
98be39b) - roxygen: resolve user link-reference definitions (
6bcb008) - roxygen: nodeify same-line markup reference links (
c5e3fc3) - roxygen: drop shortcut links with non-plain display (
e56d66b) - roxygen: demote undefined-label shortcut/ref links (
4d52240) - parser: drop
@sectionto NA on md-off brace imbalance (30669fc) - parser: drop
@field/@slottag on raw brace imbalance (8c8c0e5) - parser: drop md-off prose sections on brace imbalance (
497f3f7) - parser: resolve nested md links with opener deactivation (
859006d) - parser: drop md sections on
rdCompleteimbalance (bca67f5) - parser: lex @rawRd body as Rd, never markdown (
81bdf09) - roxygen: leak opaque nested-bracket inline-link inner candidate (
46a6110) - roxygen: leak get_md_linkrefs defs for image alt-text (
1c51798) - roxygen: leak get_md_linkrefs defs for inline-link candidates (
8185a92) - roxygen: leak get_md_linkrefs defs in field/section bodies (
ee65a6c) - roxygen: model mixed valid+invalid link-ref poisoning (
97dcd47) - roxygen: leak get_md_linkrefs defs for escaped-close
[text\](7829072) - parser: resolve cross-line @md shortcut links (
81e2747) - parser: escaped @md brackets [ ] are not link delimiters (
70d95b4) - parser: resolve cross-line @md reference links (
04325a1) - parser: preserve Unicode whitespace in roxygen norm_ws (
d935f05) - parser: resolve @md inline links across soft line breaks (
8310e0e) - parser: resolve @md inline link text on the delimiter stack (
188ce50) - parser: underscore-leading code span renders \verb not \code (
c4b3174) - parser: empty md list item can't interrupt a paragraph (
250eee0) - parser: resolve @md emphasis across soft line breaks (
67e5003) - parser: resolve @md emphasis via CommonMark delimiter stack (
dbc9989) - roxygen: project non-md Rd % as a line comment (
b0b6be2) - parser: model mid-prose \preformatted block-macro opener (
c554c14) - roxygen: project \preformatted as a verbatim block macro (
aa92fe6) - parser: model nested markdown lists by indentation (
b313550) - parser: model nested Rd block macros (\itemize in \enumerate) (
bfe7e32) - roxygen: project @rawRd as bare top-level Rd nodes (
fd76c95) - parser: model @md block raw HTML as \if{html}{\out} (
6192663)
Bug Fixes ​
- roxygen: honor soft-wrap line for %-swallow (
b67b966) - linter: only flag function shadows in shadowed-builtin (
f8a30ce) - linter: exempt c() from duplicated-arguments (
6f0db6d) - linter: attach testthat implicitly for test files (
95067fa) - linter: keep excluded package files in scope (
c79953a) - linter: exempt parameters from shadowed-builtin (
de10514) - linter: count infix operator use as a read (
e3bc112) - linter: dont flag super-assignment as unused (
8835944) - linter: count pkg:::name as cross-file use (
d72b5b4) - linter: dont flag builtin shadow used only in own rhs (
22243b1) - formatter: reflow roxygen prose past inline list markers (
5798c5e) - formatter: keep roxygen link-ref defs unjoined (
877d7c6) - formatter: don't reflow non-md roxygen prose across % (
584f489)
0.7.0 (2026-06-24) ​
Features ​
- parser: model @md inline raw HTML as \if{html}{\out} (
a2f5cc9) - roxygen: sub-render inline-link code-span text to \verb/\code (
585b096) - parser: model @md URL autolinks and empty-dest links as \url (
7bc2879) - parser: model @md fenced code blocks, project to \preformatted (
06509b3) - parser: project brace-less unknown Rd macros to UNKNOWN (
50572be) - roxygen: project @section body inlines with GRP-wrap (
95dbbfb) - roxygen: aggregate multiple @examples into one \examples (
37357fb) - parser: lex Rd macro names with digits (\linkS4class) (
856be51) - parser: project markdown images and Rd \figure to \figure (
0afed9a) - roxygen: split intro into title/description/details by paragraph (
fb2c926) - parser: resolve @md reference and shortcut links to \link (
fd8b6d2) - parser: project @md inline links text to \href (
4cd8cfa) - roxygen: aggregate @slot/@field into \section{Slots,Fields} (
19f326e) - parser: model \href as two-arg macro with verbatim URL arg (
a129a7a) - roxygen: project \code body as verbatim RCODE (
5ec9cf3) - roxygen: suppress sections with NULL sentinel value (
be2d579) - roxygen: project title as description fallback (
e9f2471) - parser: model @md markdown lists as \itemize/\enumerate (
1cf5da9) - parser: model @md inline markdown (emph/strong/code) (
6e617ca) - parser: model
\tabular{fmt}{ … \tab … \cr }block macro (8cfbdbe) - parser: model two-arg \item{term}{def} in \describe (
c1b30a9) - linter: suppress undefined-symbol for data-masked columns (
d1e382d) - linter: resolve meta-package attaches for undefined-symbol (
d64cd31) - parser: model \itemize/\enumerate block Rd macros (
dc8a38b) - parser: model inline Rd macros as nested CST nodes (
be0521b) - roxygen: bulk-pin projector-eligible harvested corpus (
58ad5e4) - roxygen: add CST->Rd projector + pinned parity gate (
7473f2f)
Bug Fixes ​
- semantic: mask operands of opaque custom infix operators (
479c3dd) - parser: model string-named call/subscript args as named args (
4e2fdbf) - formatter: don't treat mid-prose years as list markers (
d90e7d5)
0.6.0 (2026-06-22) ​
Features ​
- cli: add global --color, --quiet, --verbose flags (
1bef2ae) - cli: add completions and init subcommands (
ea055bc) - cli: lint reads stdin, drop no-op --check flag (
5237c95) - config: add top-level exclude/default-exclude file filtering (
8a3c661) - config: add format.line-ending (auto/lf/crlf/native) (
033937a) - linter: add unreachable-code rule (after return()/stop()) (
52eb74b) - linter: add any-duplicated rule (any(duplicated(x)) -> anyDuplicated(x) > 0) (
e3d6348) - linter: add any-is-na rule (any(is.na(x)) -> anyNA(x)) (
3d8590d) - linter: add comparison-negation and outer-negation rules (
caeda1a) - roxygen: format embedded R in @examples bodies (
8715ad4) - roxygen: hanging-indent reflow of tag prose (
8e52c62) - roxygen: reflow prose to line width (
b5e92c5) - linter: add vector-logic rule (&/| -> &&/|| in conditions) (
2e74063) - linter: add repeat rule (while (TRUE) -> repeat) (
93cff91) - formatter: normalize roxygen marker + single space (
52b96f6) - parser: parse roxygen doc comments into the CST (
23fe61f) - linter: generate rule docs from rule metadata (
e8ef3db) - lsp: add pull diagnostics support (
e8da220) - lsp: add call hierarchy support (
24d52f3) - lint: add true-false-symbol rule (
1a37cfa)
Bug Fixes ​
- formatter: preserve trailing blank lines in roxygen examples (
7ca4fd1) - parser: bind unary
!looser than comparison operators (a386bc4) - formatter: handle comments in if/while conditions (
5ba6f02), fixes #37
0.5.0 (2026-06-18) ​
Features ​
- lsp: add semantic tokens (full) (
7f578d2) - lsp: rename binding-only reads instead of refusing (B2.4) (
b4643d8) - lsp: add workspace/symbol fuzzy name search (
56ba0dc) - lint: wire CLI --select/--ignore flags (
a3f7844) - lint: add resolves_to_base namespace-confirmation helper (
2bfb17f) - lint: add §I1 matchers and first Phase 1 rule batch (
e39e6ba) - lsp: narrow dynamic-source refusal in cross-file rename (
93f601b) - index: add opt-in downloadable CRAN symbol sidecar (
84da1fb) - lsp: add signature help (
85efe66) - lsp: add completion (
59d01fa) - lsp: add folding range support (
824ab9d) - lsp: add file rename support (
81f4752) - lsp: load-order resolution for cross-file rename/references (
617ccb0) - lsp: scope-aware cross-file rename and references (
1aa7f8c) - lsp: cross-file symbol rename (
3b12b12) - cli: add diff print to
--check(16ebdf3)
Bug Fixes ​
- lsp: bind reader body reads to final scope (B2.4) (
0f367d5) - project: classify source() path relativity host-independently (
751406e) - semantic: don't record reserved constants as reads (
9848162) - index: probe .libPaths() for launcher-injected libraries (
ed729f1) - linter: only flag shadowed-builtin on call-position reads (
fca8ef7) - formatter: don't break out
[[unnecessarily (81543c8) - ci: default cran-symbols window to 30 days (
c581c4b) - format trailing comments after binary and pipe operators (
e9d41b2), closes #29 and #30 - parser: lex ...-prefixed names as one identifier (
c3a42b2) - parser: lex dot-leading numeric literals (
e5923fa), closes #27 - formatter: format := (walrus) assignment operator (
e80a0fc), closes #26, #28, #31, and #32 - formatter: break over-width if condition onto its own line (
0b26da6) - formatter: don't break
[[group (89e3eb7) - parser: parse function parameter defaults as expressions (
5cd36e1) - parser: lex backtick-quoted and bare-dot names (
2a6252a) - linter: eliminate unused-binding false positives (
c941fcb)
Performance Improvements ​
- incremental: make workspace_project pure via PackageGraph input (
0409a6a)
0.4.0 (2026-06-12) ​
Features ​
- add npm distribution (arity-cli) (
ea0658b)
0.3.0 (2026-06-12) ​
Features ​
- add VS Code / Open VSX extension (
4501ec4) - lsp: index default R packages for hover (
3bf0927) - build man pages and completion and cli docs (
660d947)
0.2.0 (2026-06-12) ​
Breaking changes ​
- rename package to arity (
979371b)
Features ​
- lsp: document symbols outline (
b203c2f) - lsp: find-references + document highlight (
12e7566) - lsp: add go-to-definitions (
f74a087) - lsp: cross-edit node refs + intra-file rename (
64533de) - project: workspace-wide symbol/reference index (
8920e6f) - incremental: model the package index as a HIGH-durability salsa input (
d04b2cb) - symbols: bundle top-500 CRAN export lists (
0c2a59b) - parser: incremental token/block reparse (
231e0f3) - lsp: wrap project scope as tracked salsa queries (
5006a04) - lsp: add range formatting (
c0dafe1) - lsp: preempt in-flight lint on a fresher edit (
81b2e71) - lsp: reuse salsa db for hover/format/code-action reads (
e90dd68) - lsp: add init options (
3e6757b) - lsp: cross-file resolution for the active document (
1e7f046) - linter: honor NAMESPACE exports and imports (
7177f47) - linter: resolve bindings across files in a project (
44c1938) - project: add source() edge and file-export extractors (
cc5ee3d) - lsp: lint off a persistent salsa database (
54afbe1) - incremental: cache parse tree + semantic model in salsa (
8651d0c) - formatter: hug trailing block past an unbreakable atom (
cfc892c) - formatter: rest-aware group fit; break inner hug on overflow (
e493d0d) - formatter: line width wins over hug; explode instead (
579621a) - add space after
=infn(NULL =)(e311b0d) - formatter: adopt air's always-brace for control flow (
c583583) - inline
{{ x }}syntax (accf8a8) - formatter: pack leading argument holes inline (
cd78c06) - lsp: hover with indexed package help (
e6e0b66) - rindex: harvest full Rd help bodies as markdown (
8833905) - lsp: load the index and lazily build missing packages (
f1852c4) - linter: enable undefined-symbol behind an all-indexed gate (
8a5861d) - rindex: harvest function formals from lazy-load DBs (
5693f7c) - rindex: on-disk R-introspection sidecar (
ravel index) (36c8aae) - linter: autofix infrastructure, --fix, and LSP code actions (
76dcb44) - linter: semantic foundation, suppression directives, and LSP diagnostics (
2f121a2) - lsp: add initial lsp with formatting capabilities (
e8e2a73) - add a config (
058b8af) - formatter: support
@slot extraction as sticky operator (c46b761) - support the walrus operator (
b2549b6) - parser: lex
**as exponentiation synonym for^(fa6d90a) - parser: handle help operators (
d7e9ab7) - parser: lex imaginary suffix as complex literal (
4732bb3) - parser: recognize unary tilde formula operator (
edc90bc) - formatter: conditional group for break-aware fits (
410dd48) - formatter: handle nested expressions/curly-curly (
e041594) - formatter: handle magrittr pipes (
8bb6a56) - cli: format in place if file provided (
eac1fe3) - formatter: handle binary operators (
0bd8db6) - formatter: handle complex comment cases (
340ced7) - formatter: handle curly-curlies and whitespace (
1c4d189) - formatter,parser: handle complex if-else cases (
09beb1e) - formatter: handle repeat constructs (
2425148) - formatter: handle empty functions (
a2d04c9) - formatter: handle some parenthesized expressions (
27bf2fd) - parser,formatter: handle comment prefixed args (
630df1c) - formatter: handle more complex subsetting cases (
a1efad0) - formatter: handle comment in subset (
a6be358) - formatter: add support for subsetting with holes (
790f63d) - formatter: handle basic subsetting and holes (
000b3f7) - formatter: flatten simple functions (
0881304) - formatter: handle more function cases (
20033bb) - formatter,parser: handle comments in function defs (
e844b23) - formatter: handle lambdas (
3aecd57) - formatter: support
[[subsetting (52f32f2) - formatter: harden support around hugging and calls (
961d748) - formatter: add call hugging support (
e92401f) - formatter: handle blanklines between function arguments (
2398618) - formatter: handle curly-curly (
3d47fe1) - formatter,parser: handle empty RHS (
978828c) - formatter: handle comments and continuations in calls (
d534d66) - parse,formatter: handle lambdas and trailing functions (
5ad396b) - formatter: handle training braces (
3103ac3) - formatter: handle comments after holes (
310bde3) - formatter: handle comments inside holes (
17e7b12) - formatter: tackle holes in calls (
b57fc73) - formatter: support calls and handle line breaks (
f1ae921) - formatter: support basic calls (
b95eeac) - formatter: support while statements (
4e7d3e5) - formatter: support for statements (
0f4f836) - formatter: handle blanklines and functions (
363fbd8) - formatter: don't add spaces for carets (
461f329) - refactor formatter (
a7d5600) - parser: wrap up air test parity (
9e5ca51) - parser: handle double colon namespace error (
99c2259) - parser: handle dots and repeats (
84c790c) - parser: extend to air fixtures (
d411968) - parser: extend to subset assignment (
f19572a) - parser: suppor subsetting brackets (
c80a021) - parser: add multiple new operators (
c2ca22c) - parser: add semicolon, comma (
4f4e76f) - parser: add newline-sensitive boundaries (
fd490f4) - parser: add slash, minus, colon (
d45cb7e) - parser: expand operator coverage (
939667e) - parser: improve coverage and add operator precedence (
085e59b) - add a linter (
72519c1) - add more parsing cases (
4982f1c) - lay groundwork for formatter and parser (
76005cd) - parser: expand to handle more cases (
2783429) - add cli, with parse command (
8a2b5e9) - add a minimal parser (
1c0289c) - setup basic package infrastructure (
835dad5)
Bug Fixes ​
- ci: avoid SIGPIPE in CRAN ranking script (
c8703ad) - formatter: render comment-free if/else as native IR (
bd9e8c6) - formatter: indent pipe RHS so broken calls nest correctly (
af16e75) - lsp: handle URIs properly on windows (
130c741) - formatter: keep else-if chains flat, brace consistently (
e16aa86) - parser: skip comments around if-clause boundaries (
da34806) - formatter: handle comments between if-body and else (
9336fa1) - parser: handle newline between subset args (
c9e41d1) - parser: newline terminates complete top-level expressions (
23a63c3) - properly handle CLRF (
f147ad6)
Performance Improvements ​
- rindex: parallelize package harvest across rayon (
8852209)
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):
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 ​
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 ​
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 ​
Treat CI (.github/workflows/) as the source of truth. Before opening a pull
request, make sure the following all pass locally:
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 ​
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.
- Integration tests live in each crate's
tests/*.rs: parser suites incrates/arity-parser/tests/(fixtures incrates/arity-parser/tests/fixtures/parser/<case>/, holdinginput.R; the CST and diagnostics are snapshotted, losslessness asserted), formatter suites incrates/arity-formatter/tests/(fixtures incrates/arity-formatter/tests/fixtures/formatter/<case>/, holdinginput.Rplusexpected.R), and everything else (linter, LSP, salsa, roxygen oracles, rindex) in the roottests/. - Both fixture suites are hand-registered. A new case does not run until its
directory name is added to
fixture_names()incrates/arity-parser/tests/parser_snapshots.rsorcrates/arity-formatter/tests/formatter.rs. This is the most common way a new test silently does nothing. - Snapshot tests use
insta. Review and accept snapshots withcargo insta revieworcargo insta accept. - Logging is currently inert:
env_loggeris a dependency but nothing initializes it, soRUST_LOG(andtask test-debug) has no effect. Reach fordbg!or a test-local print for now.
Your first change ​
The loop differs a little per subsystem. Pick the one your change lands in.
A formatter bug (output is wrong, ugly, or unstable):
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):
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 ​
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:
exclude--- gitignore-style patterns; setting it replaces the built-in default set.extend-excludeadds to the defaults instead, which is usually what you want.cache--- enable the persistent already-formatted cache (--no-cacheoverrides it for one run).[format]---line-width,indent-width,line-ending(auto/lf/crlf/native).[lint]---select(an allowlist; when set, only those rules run) andignore(subtracted from whichever set is active).[index]---library-paths,cache-dir,auto-build,help.
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 ​
- 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:
format -writes only the formatted buffer to stdout, errors to stderr, and exits non-zero to mean "do not use this output".lintdiffers by design: exit 1 means findings remain,--fixstill writes the fixed source, and JSON findings go to stdout while human ones go to stderr.- A buffer has no path to walk up from, so
cwd_anchor()insrc/main.rsanchors config discovery, and a caller selects the applicable project config through its cwd. - A pathless buffer is R unless
--stdin-filenamesays otherwise.DESCRIPTIONis already carved out of that default, so it is load-bearing.
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 ​
These are the load-bearing invariants; see AGENTS.md for the full
statements.
- 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.
- Incremental parsing is first-class. Keep the
salsa-based incremental reparse path (src/incremental.rs) viable. - 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.
- Losslessness is the parser's job. The parser preserves all text, so
reconstruct(text) == textalways. 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 ​
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:
# 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 ​
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 ​
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 ​
Speed is a feature here, and it is measured rather than asserted.
task benchrunsscripts/bench.sh: the formatter againstair(and, opt-in,styler) and the linter againstjarl, each at two scopes --- synthetic single-file tiers built from the formatter fixtures, and a real R package (tidyr, cloned once into a cache). It rewrites the tracked artifactbenches/benchmark_results.json.- That artifact is the only source of the published benchmark page.
task docs-genrenders it into the generated partials; the numbers are never re-measured at site-build time or in CI. So if you change something that moves performance and want the docs to reflect it, re-runtask benchand commit the artifact. task bench-parseis a criterion microbenchmark of parse and incremental reparse (crates/arity-parser/benches/parse.rs) --- the right tool for a parser-level change.- For profiling, devenv provides
perf,cargo-flamegraph,hyperfine, andcargo-llvm-cov.
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 ​
Beyond the crate, the repo builds several distribution artifacts. You only need these if your change touches them.
- VS Code extension (
editors/code) --- TypeScript, bundled with esbuild.npm run compile(type-check plus bundle),npm run watchwhile developing,npm run packagefor a VSIX. It is linted and formatted bybiome(a git hook and a CI job), and versioned separately from the crate (arity-code, following the crate's releases). At publish time a platform-specificaritybinary is downloaded from the GitHub release intoeditors/code/server/and packaged into a per-target VSIX; at runtime the extension resolves the server viaarity.executableStrategy(bundled/environment/path), falling back toarityon PATH --- which is also what it does on NixOS, where a downloaded binary would not run. - npm (
npm/) ---arity-cliis a thin launcher whoseoptionalDependenciespull in one@arity-cli/<platform>package per target;npm/platform-templateis the template those are generated from. The versions are bumped automatically (see below), so do not hand-edit them. - PyPI --- built by maturin from
pyproject.toml. - Release binaries --- eight targets (Linux gnu/musl, macOS, and Windows,
each x86_64 and aarch64), cross-built with
cargo-zigbuildwhere needed and checked against a glibc floor.
Commits and pull requests ​
- Use Conventional Commits
(
type(scope): subject) and semantic versioning. - Keep the subject in the imperative mood and short (aim for 60 chars or under, 72 at most). Use the body for concise explanations when needed.
- Wrap code in backticks in commit messages, and avoid fancy Unicode characters.
- Reference issues in the body (e.g.
Fixes #123) when applicable. - Never edit the changelog by hand; it is generated by
versionary.
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 ​
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:
- Never hand-edit
CHANGELOG.mdor any of the version fields. They are generated, and your edit will be overwritten. feat:bumps the minor version,fix:the patch; a!or aBREAKING CHANGE:footer bumps the major. The project is pre-1.0 withbump-minor-pre-major, so breaking changes currently land as minor bumps.- A commit that only touches
editors/,crates/arity-parser, orcrates/arity-formatteris excluded from the CLI's version calculation, so keep commits atomic per area --- a commit that mixes parser and CLI changes bumps both.
Reporting issues ​
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 ​
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:
arity init
The generated file contains commented settings. A small active configuration might look like this:
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:
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:
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:
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:
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.
Ignore rules for selected files ​
Use lint.per-file-ignores to disable individual rules in part of a project:
[lint.per-file-ignores]
"sess/inst/tinytest/**" = ["undefined-symbol"]
This keeps other rules and parse-error reporting active in those tests. Patterns are relative to the selected config file, and every matching entry contributes ignores. The CLI and language server apply the same settings, including fixes and explicitly named files. See file ignores for glob syntax and inheritance.
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:
[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:
{
"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:
arity.formatting.enable— use arity as a formatter.arity.diagnostics.enable— show arity diagnostics (the linter).arity.languageFeatures.enable— hover, completion, navigation, symbols, rename, code actions, semantic tokens, and the rest.
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:
{
"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:
{
"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:
{
"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:
{
"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:
-- 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):
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:
[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:
[[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:
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:
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:
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:
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:
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:
cat R/example.R | arity format -
Standard input is treated as R source unless you supply --stdin-filename. For
a package description, use:
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:
[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.
Function bodies ​
Functions assigned to a name or target always use braces and an expanded body, even when the body is a single expression:
f <- function(x) {
x + 1
}
Anonymous functions can stay compact when the whole definition fits on one line.
This applies to both function(...) callbacks and \(...) lambdas, including
callbacks passed through named arguments:
map(xs, function(x) x + 1)
map(xs, \(x) x + 1)
map(xs, .f = function(x) x + 1)
These rules do not depend on input line breaks or existing braces. Anonymous
functions expand when needed for width or comments. Empty bodies stay {}.
Unlike Air, Arity always expands assigned functions and can collapse a short,
braced anonymous function to its compact form.
Preserve selected layout ​
Use a formatter directive when a particular statement needs hand-written layout:
# 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:
curl --proto '=https' --tlsv1.2 -sSf https://arity.cc/install | sh
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:
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:
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:
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:
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:
- 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:
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:
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:
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:
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:
{
"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:
[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:
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:
cat R/example.R | arity lint --stdin-filename R/example.R -
For compact output or a JSON array of diagnostics:
arity lint --output concise .
arity lint --output json .
JSON diagnostics go to stdout, including [] when there are no findings.
Human-readable diagnostics and informational messages go to stderr.
Resolve script dependencies ​
Arity follows literal source() and sys.source() calls between analyzed
files. For relative source paths, it assumes R starts in the nearest enclosing
package root (a directory with DESCRIPTION and R/). Outside a package, it
uses the nearest Git root, then the nearest directory containing arity.toml,
then the script's own directory. Nested configs inside a Git repository do not
change this working directory.
Sourced files inherit their caller's working directory. With chdir = TRUE, the
target executes in its containing directory, and the caller's directory is
restored afterward. The CLI and language server use the same defaults.
The destination environment is independent of this directory. Plain {} blocks
share the enclosing environment. source(..., local = TRUE) loads into the
current frame, including a function's local frame. An explicit destination such
as source(..., local = helpers) or sys.source(..., envir = helpers) loads
members into that environment; it does not introduce bare global names. Arity
tracks environments created with new.env(), their simple aliases, and literal
member reads such as helpers$helper and helpers[["helper"]].
Reads respect loading order. Function analysis keeps its loading effects within that function. Conditional loads retain possible bindings without treating them as unconditional definitions. Arity does not evaluate R, resolve computed paths, or infer calls from external programs. Explicit entry-point and helper-provider declarations remain separate work.
Choose rules ​
The Lint rules reference explains each rule and its default behavior. To check a particular rule for one run:
arity lint --select equals-na .
To disable a rule for the project, put it in arity.toml:
[lint]
ignore = ["unused-binding"]
To enable an opt-in rule while keeping the defaults, use extend-select:
[lint]
extend-select = ["undesirable-function"]
For one run, use arity lint --extend-select undesirable-function ..
To disable a rule only in matching files, use a glob in arity.toml:
[lint.per-file-ignores]
"sess/inst/tinytest/**" = ["undefined-symbol"]
Other rules and parse-error reporting remain active. See the configuration reference for matching and inheritance rules.
Apply fixes ​
Apply safe fixes in place, then format the rewritten code:
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.
With stdin, --fix writes the fixed source to stdout and reports remaining
findings to stderr. Combining stdin --fix with --output json is a usage
error because both outputs require stdout. For files, --fix --output json
reports the diagnostics that remain after fixing, including [] when clean.
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:
# 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 ​
- arity:
0.23.0 - air:
0.11.0 - jarl:
0.5.0 - lintr:
3.3.0.1 - styler:
1.11.0 - backend: hyperfine (min runs: 3)
- host: linux/x86_64, AMD Ryzen 9 7900 12-Core Processor
- generated: 2026-09-16T17:40:41Z
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 ​
[{"document":"MASS/polr.R","tool":"arity","mean_ms":4.8415,"ratio":1.0,"ratio_label":"baseline","stddev_ms":0.6281,"min_ms":3.6281,"max_ms":9.1041},{"document":"MASS/polr.R","tool":"air","mean_ms":8.2043,"ratio":1.6945781266136528,"ratio_label":"1.7x slower","stddev_ms":0.5961,"min_ms":7.0727,"max_ms":12.0133},{"document":"MASS/polr.R","tool":"styler","mean_ms":3164.6802,"ratio":653.6569658163792,"ratio_label":"653.7x slower","stddev_ms":122.3425,"min_ms":3060.0818,"max_ms":3299.2111},{"document":"tidyr/pivot-wide.R","tool":"arity","mean_ms":4.4597,"ratio":1.0,"ratio_label":"baseline","stddev_ms":0.6419,"min_ms":3.2025,"max_ms":10.6042},{"document":"tidyr/pivot-wide.R","tool":"air","mean_ms":5.6126,"ratio":1.2585151467587505,"ratio_label":"1.3x slower","stddev_ms":0.6007,"min_ms":4.5239,"max_ms":9.8578},{"document":"tidyr/pivot-wide.R","tool":"styler","mean_ms":1737.511,"ratio":389.6026638563132,"ratio_label":"389.6x slower","stddev_ms":29.3376,"min_ms":1718.2032,"max_ms":1771.271},{"document":"small","tool":"arity","mean_ms":6.2978,"ratio":1.0,"ratio_label":"baseline","stddev_ms":0.986,"min_ms":4.8161,"max_ms":14.9822},{"document":"small","tool":"air","mean_ms":29.8889,"ratio":4.7459271491632,"ratio_label":"4.7x slower","stddev_ms":1.6604,"min_ms":26.5463,"max_ms":34.6716},{"document":"small","tool":"styler","mean_ms":13353.8912,"ratio":2120.405728984725,"ratio_label":"2120.4x slower","stddev_ms":307.7941,"min_ms":13063.7314,"max_ms":13676.7144},{"document":"large","tool":"arity","mean_ms":45.0165,"ratio":1.0,"ratio_label":"baseline","stddev_ms":14.3207,"min_ms":36.522,"max_ms":107.3092},{"document":"large","tool":"air","mean_ms":332.7182,"ratio":7.391027734275211,"ratio_label":"7.4x slower","stddev_ms":3.7626,"min_ms":325.1847,"max_ms":337.4778}]
Data table
MASS/polr.R (19787 bytes, 534 lines)
| Tool | Mean (ms) | Min (ms) | Max (ms) | Relative |
|---|---|---|---|---|
| arity | 4.8415 | 3.6281 | 9.1041 | baseline |
| air | 8.2043 | 7.0727 | 12.0133 | 1.7x slower |
| styler | 3164.6802 | 3060.0818 | 3299.2111 | 653.7x slower |
tidyr/pivot-wide.R (23349 bytes, 807 lines)
| Tool | Mean (ms) | Min (ms) | Max (ms) | Relative |
|---|---|---|---|---|
| arity | 4.4597 | 3.2025 | 10.6042 | baseline |
| air | 5.6126 | 4.5239 | 9.8578 | 1.3x slower |
| styler | 1737.5110 | 1718.2032 | 1771.2710 | 389.6x slower |
small (147122 bytes, 9896 lines)
| Tool | Mean (ms) | Min (ms) | Max (ms) | Relative |
|---|---|---|---|---|
| arity | 6.2978 | 4.8161 | 14.9822 | baseline |
| air | 29.8889 | 26.5463 | 34.6716 | 4.7x slower |
| styler | 13353.8912 | 13063.7314 | 13676.7144 | 2120.4x slower |
large (1765464 bytes, 118752 lines)
| Tool | Mean (ms) | Min (ms) | Max (ms) | Relative |
|---|---|---|---|---|
| arity | 45.0165 | 36.5220 | 107.3092 | baseline |
| air | 332.7182 | 325.1847 | 337.4778 | 7.4x slower |
Projects ​
[{"document":"tidyr","tool":"arity","mean_ms":23.7209,"ratio":1.0,"ratio_label":"baseline","stddev_ms":2.1579,"min_ms":20.9512,"max_ms":37.4993},{"document":"tidyr","tool":"air","mean_ms":36.1422,"ratio":1.5236437066047241,"ratio_label":"1.5x slower","stddev_ms":1.11,"min_ms":33.7529,"max_ms":39.3543},{"document":"MASS","tool":"arity","mean_ms":33.3608,"ratio":1.0,"ratio_label":"baseline","stddev_ms":1.71,"min_ms":31.1454,"max_ms":42.0423},{"document":"MASS","tool":"air","mean_ms":63.3019,"ratio":1.8974934653845235,"ratio_label":"1.9x slower","stddev_ms":1.8568,"min_ms":59.795,"max_ms":67.5271}]
Data table
tidyr (245685 bytes, 8774 lines)
| Tool | Mean (ms) | Min (ms) | Max (ms) | Relative |
|---|---|---|---|---|
| arity | 23.7209 | 20.9512 | 37.4993 | baseline |
| air | 36.1422 | 33.7529 | 39.3543 | 1.5x slower |
MASS (214820 bytes, 5951 lines)
| Tool | Mean (ms) | Min (ms) | Max (ms) | Relative |
|---|---|---|---|---|
| arity | 33.3608 | 31.1454 | 42.0423 | baseline |
| air | 63.3019 | 59.7950 | 67.5271 | 1.9x slower |
Linter ​
Single files ​
[{"document":"MASS/polr.R","tool":"arity","mean_ms":33.1615,"ratio":1.0,"ratio_label":"baseline","stddev_ms":1.8477,"min_ms":29.7368,"max_ms":39.1127},{"document":"MASS/polr.R","tool":"jarl","mean_ms":12.9628,"ratio":0.3908990847820515,"ratio_label":"2.6x faster","stddev_ms":0.5789,"min_ms":11.9096,"max_ms":16.1438},{"document":"MASS/polr.R","tool":"lintr","mean_ms":1065.3256,"ratio":32.1253743045399,"ratio_label":"32.1x slower","stddev_ms":5.5348,"min_ms":1058.9672,"max_ms":1069.0634},{"document":"tidyr/pivot-wide.R","tool":"arity","mean_ms":30.8709,"ratio":1.0,"ratio_label":"baseline","stddev_ms":1.7786,"min_ms":27.8587,"max_ms":41.4557},{"document":"tidyr/pivot-wide.R","tool":"jarl","mean_ms":10.6234,"ratio":0.34412343015590735,"ratio_label":"2.9x faster","stddev_ms":0.6517,"min_ms":9.5503,"max_ms":14.3922},{"document":"tidyr/pivot-wide.R","tool":"lintr","mean_ms":902.9177,"ratio":29.248181944808866,"ratio_label":"29.2x slower","stddev_ms":10.5485,"min_ms":893.4831,"max_ms":914.3067},{"document":"small","tool":"arity","mean_ms":30.1509,"ratio":1.0,"ratio_label":"baseline","stddev_ms":1.0012,"min_ms":28.3004,"max_ms":33.713},{"document":"small","tool":"jarl","mean_ms":31.1111,"ratio":1.0318464788779107,"ratio_label":"1.0x slower","stddev_ms":1.271,"min_ms":28.95,"max_ms":34.17},{"document":"small","tool":"lintr","mean_ms":13989.4429,"ratio":463.9809392091115,"ratio_label":"464.0x slower","stddev_ms":1890.3543,"min_ms":11809.6553,"max_ms":15178.5032},{"document":"large","tool":"arity","mean_ms":728.6282,"ratio":1.0,"ratio_label":"baseline","stddev_ms":252.8363,"min_ms":572.0615,"max_ms":1020.3157},{"document":"large","tool":"jarl","mean_ms":492.3987,"ratio":0.6757886944260462,"ratio_label":"1.5x faster","stddev_ms":28.2576,"min_ms":471.999,"max_ms":547.0819}]
Data table
MASS/polr.R (19787 bytes, 534 lines)
| Tool | Mean (ms) | Min (ms) | Max (ms) | Relative |
|---|---|---|---|---|
| arity | 33.1615 | 29.7368 | 39.1127 | baseline |
| jarl | 12.9628 | 11.9096 | 16.1438 | 2.6x faster |
| lintr | 1065.3256 | 1058.9672 | 1069.0634 | 32.1x slower |
tidyr/pivot-wide.R (23349 bytes, 807 lines)
| Tool | Mean (ms) | Min (ms) | Max (ms) | Relative |
|---|---|---|---|---|
| arity | 30.8709 | 27.8587 | 41.4557 | baseline |
| jarl | 10.6234 | 9.5503 | 14.3922 | 2.9x faster |
| lintr | 902.9177 | 893.4831 | 914.3067 | 29.2x slower |
small (147122 bytes, 9896 lines)
| Tool | Mean (ms) | Min (ms) | Max (ms) | Relative |
|---|---|---|---|---|
| arity | 30.1509 | 28.3004 | 33.7130 | baseline |
| jarl | 31.1111 | 28.9500 | 34.1700 | 1.0x slower |
| lintr | 13989.4429 | 11809.6553 | 15178.5032 | 464.0x slower |
large (1765464 bytes, 118752 lines)
| Tool | Mean (ms) | Min (ms) | Max (ms) | Relative |
|---|---|---|---|---|
| arity | 728.6282 | 572.0615 | 1020.3157 | baseline |
| jarl | 492.3987 | 471.9990 | 547.0819 | 1.5x faster |
Projects ​
[{"document":"tidyr","tool":"arity","mean_ms":32.1305,"ratio":1.0,"ratio_label":"baseline","stddev_ms":1.6109,"min_ms":28.5647,"max_ms":37.8632},{"document":"tidyr","tool":"jarl","mean_ms":13.8226,"ratio":0.4302018331491885,"ratio_label":"2.3x faster","stddev_ms":0.9254,"min_ms":12.2326,"max_ms":19.1293},{"document":"tidyr","tool":"lintr","mean_ms":9238.4568,"ratio":287.529195001634,"ratio_label":"287.5x slower","stddev_ms":61.0105,"min_ms":9186.3826,"max_ms":9305.5851},{"document":"MASS","tool":"arity","mean_ms":35.8673,"ratio":1.0,"ratio_label":"baseline","stddev_ms":1.9851,"min_ms":30.994,"max_ms":40.1854},{"document":"MASS","tool":"jarl","mean_ms":20.561,"ratio":0.5732519593055513,"ratio_label":"1.7x faster","stddev_ms":2.0127,"min_ms":16.7284,"max_ms":28.7741},{"document":"MASS","tool":"lintr","mean_ms":9519.1274,"ratio":265.3984938927658,"ratio_label":"265.4x slower","stddev_ms":80.0788,"min_ms":9438.2252,"max_ms":9598.3566}]
Data table
tidyr (245685 bytes, 8774 lines)
| Tool | Mean (ms) | Min (ms) | Max (ms) | Relative |
|---|---|---|---|---|
| arity | 32.1305 | 28.5647 | 37.8632 | baseline |
| jarl | 13.8226 | 12.2326 | 19.1293 | 2.3x faster |
| lintr | 9238.4568 | 9186.3826 | 9305.5851 | 287.5x slower |
MASS (214820 bytes, 5951 lines)
| Tool | Mean (ms) | Min (ms) | Max (ms) | Relative |
|---|---|---|---|---|
| arity | 35.8673 | 30.9940 | 40.1854 | baseline |
| jarl | 20.5610 | 16.7284 | 28.7741 | 1.7x faster |
| lintr | 9519.1274 | 9438.2252 | 9598.3566 | 265.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/.
task bench-lsp
task docs-gen
For a short harness check that leaves the published results alone:
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 ​
- Generated: 2026-09-28T20:27:32.650494+00:00
- Host: Linux/x86_64, AMD Ryzen 9 7900 12-Core Processor
- Corpus: tidyr v1.3.2 at
bfdfc359b90b5f1432eb9de21cd03d9c11893137 - Open buffers: 5 files, 82999 bytes including benchmark bindings
- Workload: 3 fresh processes per server, 1000 edits per process
- Warm requests: 2 warmups and 20 measured rounds per target per process
- Settling: 5 seconds below 5% of one CPU core, sampled every 0.15 seconds
- arity:
arity 0.24.0 - languageserver:
languageserver 0.3.18; R 4.6.1; lintr 3.3.0.1 - ark:
Ark 0.1.252; R version 4.6.1 (2026-06-24)
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 ​
{"kind":"ratio","points":[{"detail":"Median across fresh processes","document":"Initialize","ratio":1.0,"ratio_label":"baseline","tool":"arity","value":2.0660000000000003},{"detail":"Median across fresh processes","document":"Initialize","ratio":480.17618586640845,"ratio_label":"480.18× arity","tool":"languageserver","value":992.044},{"detail":"Median across fresh processes","document":"Initialize","ratio":338.7270087124879,"ratio_label":"338.73× arity","tool":"ark","value":699.8100000000001},{"detail":"Median across fresh processes","document":"Workspace ready","ratio":1.0,"ratio_label":"baseline","tool":"arity","value":152.225},{"detail":"Median across fresh processes","document":"Workspace ready","ratio":30.71078994908852,"ratio_label":"30.71× arity","tool":"languageserver","value":4674.95},{"detail":"Median across fresh processes","document":"Workspace ready","ratio":5.004880932829693,"ratio_label":"5.00× arity","tool":"ark","value":761.8679999999999},{"detail":"Median across fresh processes","document":"Open files ready","ratio":1.0,"ratio_label":"baseline","tool":"arity","value":483.728},{"detail":"Median across fresh processes","document":"Open files ready","ratio":3.8249822214136873,"ratio_label":"3.82× arity","tool":"languageserver","value":1850.2510000000002},{"detail":"Median across fresh processes","document":"Open files ready","ratio":0.2504713392650415,"ratio_label":"0.25× arity","tool":"ark","value":121.16000000000001},{"detail":"Median across fresh processes","document":"Edit workload","ratio":1.0,"ratio_label":"baseline","tool":"arity","value":1681.057},{"detail":"Median across fresh processes","document":"Edit workload","ratio":27.297189803796062,"ratio_label":"27.30× arity","tool":"languageserver","value":45888.132},{"detail":"Median across fresh processes","document":"Edit workload","ratio":2.3138257655748737,"ratio_label":"2.31× arity","tool":"ark","value":3889.6730000000002}],"ratio_title":"Time relative to arity","value_title":"Median (ms)"}
Data table
| Measurement | Server | Median (ms) | Relative | Details |
|---|---|---|---|---|
| Initialize | arity | 2.066 | baseline | Median across fresh processes |
| Initialize | languageserver | 992.044 | 480.18× arity | Median across fresh processes |
| Initialize | ark | 699.810 | 338.73× arity | Median across fresh processes |
| Workspace ready | arity | 152.225 | baseline | Median across fresh processes |
| Workspace ready | languageserver | 4674.950 | 30.71× arity | Median across fresh processes |
| Workspace ready | ark | 761.868 | 5.00× arity | Median across fresh processes |
| Open files ready | arity | 483.728 | baseline | Median across fresh processes |
| Open files ready | languageserver | 1850.251 | 3.82× arity | Median across fresh processes |
| Open files ready | ark | 121.160 | 0.25× arity | Median across fresh processes |
| Edit workload | arity | 1681.057 | baseline | Median across fresh processes |
| Edit workload | languageserver | 45888.132 | 27.30× arity | Median across fresh processes |
| Edit workload | ark | 3889.673 | 2.31× arity | Median across fresh processes |
Request latency ​
{"kind":"ratio","points":[{"detail":"p95: 0.810 ms; samples: 180; empty: 0; returned items: 66–120; result bytes: 12975–23793; stale responses: 0","document":"Document symbols","ratio":1.0,"ratio_label":"baseline","tool":"arity","value":0.544},{"detail":"p95: 36.417 ms; samples: 180; empty: 0; returned items: 6–17; result bytes: 1217–3477; stale responses: 0","document":"Document symbols","ratio":54.86397058823529,"ratio_label":"54.86× arity","tool":"languageserver","value":29.846},{"detail":"p95: 0.639 ms; samples: 180; empty: 0; returned items: 6–18; result bytes: 2031–5186; stale responses: 0","document":"Document symbols","ratio":0.9669117647058824,"ratio_label":"0.97× arity","tool":"ark","value":0.526},{"detail":"p95: 0.958 ms; samples: 60; empty: 0; returned items: 1–1; result bytes: 811–811; stale responses: 0","document":"Hover","ratio":1.0,"ratio_label":"baseline","tool":"arity","value":0.749},{"detail":"p95: 19.743 ms; samples: 60; empty: 0; returned items: 1–1; result bytes: 1880–1880; stale responses: 0","document":"Hover","ratio":24.65554072096128,"ratio_label":"24.66× arity","tool":"languageserver","value":18.467},{"detail":"p95: 14.163 ms; samples: 60; empty: 0; returned items: 1–1; result bytes: 1675–1675; stale responses: 0","document":"Hover","ratio":15.945260347129505,"ratio_label":"15.95× arity","tool":"ark","value":11.943},{"detail":"p95: 0.085 ms; samples: 60; empty: 0; returned items: 1–1; result bytes: 166–166; stale responses: 0","document":"Go to definition","ratio":1.0,"ratio_label":"baseline","tool":"arity","value":0.066},{"detail":"p95: 19.716 ms; samples: 60; empty: 0; returned items: 1–1; result bytes: 166–166; stale responses: 0","document":"Go to definition","ratio":268.6363636363636,"ratio_label":"268.64× arity","tool":"languageserver","value":17.73},{"detail":"p95: 0.162 ms; samples: 60; empty: 0; returned items: 1–1; result bytes: 274–274; stale responses: 0","document":"Go to definition","ratio":1.5606060606060606,"ratio_label":"1.56× arity","tool":"ark","value":0.103},{"detail":"p95: 0.091 ms; samples: 60; empty: 0; returned items: 2–2; result bytes: 335–335; stale responses: 0","document":"Find references","ratio":1.0,"ratio_label":"baseline","tool":"arity","value":0.07},{"detail":"p95: 48.012 ms; samples: 60; empty: 0; returned items: 2–2; result bytes: 335–335; stale responses: 0","document":"Find references","ratio":641.3571428571429,"ratio_label":"641.36× arity","tool":"languageserver","value":44.895},{"detail":"p95: 0.310 ms; samples: 60; empty: 0; returned items: 2–2; result bytes: 335–335; stale responses: 0","document":"Find references","ratio":2.9428571428571426,"ratio_label":"2.94× arity","tool":"ark","value":0.206},{"detail":"p95: 0.092 ms; samples: 60; empty: 0; returned items: 2–2; result bytes: 317–317; stale responses: 0","document":"Rename","ratio":1.0,"ratio_label":"baseline","tool":"arity","value":0.059},{"detail":"p95: 48.880 ms; samples: 60; empty: 0; returned items: 2–2; result bytes: 317–317; stale responses: 0","document":"Rename","ratio":763.4745762711865,"ratio_label":"763.47× arity","tool":"languageserver","value":45.045},{"detail":"p95: 0.264 ms; samples: 60; empty: 0; returned items: 2–2; result bytes: 317–317; stale responses: 0","document":"Rename","ratio":3.6610169491525424,"ratio_label":"3.66× arity","tool":"ark","value":0.216},{"detail":"p95: 2.317 ms; samples: 3000; empty: 0; returned items: 1–1; result bytes: 166–166; stale responses: 0","document":"Edit to definition","ratio":1.0,"ratio_label":"baseline","tool":"arity","value":1.54},{"detail":"p95: 95.213 ms; samples: 3000; empty: 0; returned items: 1–1; result bytes: 166–166; stale responses: 18","document":"Edit to definition","ratio":25.069480519480518,"ratio_label":"25.07× arity","tool":"languageserver","value":38.607},{"detail":"p95: 4.945 ms; samples: 3000; empty: 0; returned items: 1–1; result bytes: 274–274; stale responses: 0","document":"Edit to definition","ratio":2.3805194805194803,"ratio_label":"2.38× arity","tool":"ark","value":3.666}],"ratio_title":"Latency relative to arity","value_title":"Median (ms)"}
Data table
| Measurement | Server | Median (ms) | Relative | Details |
|---|---|---|---|---|
| Document symbols | arity | 0.544 | baseline | p95: 0.810 ms; samples: 180; empty: 0; returned items: 66–120; result bytes: 12975–23793; stale responses: 0 |
| Document symbols | languageserver | 29.846 | 54.86× arity | p95: 36.417 ms; samples: 180; empty: 0; returned items: 6–17; result bytes: 1217–3477; stale responses: 0 |
| Document symbols | ark | 0.526 | 0.97× arity | p95: 0.639 ms; samples: 180; empty: 0; returned items: 6–18; result bytes: 2031–5186; stale responses: 0 |
| Hover | arity | 0.749 | baseline | p95: 0.958 ms; samples: 60; empty: 0; returned items: 1–1; result bytes: 811–811; stale responses: 0 |
| Hover | languageserver | 18.467 | 24.66× arity | p95: 19.743 ms; samples: 60; empty: 0; returned items: 1–1; result bytes: 1880–1880; stale responses: 0 |
| Hover | ark | 11.943 | 15.95× arity | p95: 14.163 ms; samples: 60; empty: 0; returned items: 1–1; result bytes: 1675–1675; stale responses: 0 |
| Go to definition | arity | 0.066 | baseline | p95: 0.085 ms; samples: 60; empty: 0; returned items: 1–1; result bytes: 166–166; stale responses: 0 |
| Go to definition | languageserver | 17.730 | 268.64× arity | p95: 19.716 ms; samples: 60; empty: 0; returned items: 1–1; result bytes: 166–166; stale responses: 0 |
| Go to definition | ark | 0.103 | 1.56× arity | p95: 0.162 ms; samples: 60; empty: 0; returned items: 1–1; result bytes: 274–274; stale responses: 0 |
| Find references | arity | 0.070 | baseline | p95: 0.091 ms; samples: 60; empty: 0; returned items: 2–2; result bytes: 335–335; stale responses: 0 |
| Find references | languageserver | 44.895 | 641.36× arity | p95: 48.012 ms; samples: 60; empty: 0; returned items: 2–2; result bytes: 335–335; stale responses: 0 |
| Find references | ark | 0.206 | 2.94× arity | p95: 0.310 ms; samples: 60; empty: 0; returned items: 2–2; result bytes: 335–335; stale responses: 0 |
| Rename | arity | 0.059 | baseline | p95: 0.092 ms; samples: 60; empty: 0; returned items: 2–2; result bytes: 317–317; stale responses: 0 |
| Rename | languageserver | 45.045 | 763.47× arity | p95: 48.880 ms; samples: 60; empty: 0; returned items: 2–2; result bytes: 317–317; stale responses: 0 |
| Rename | ark | 0.216 | 3.66× arity | p95: 0.264 ms; samples: 60; empty: 0; returned items: 2–2; result bytes: 317–317; stale responses: 0 |
| Edit to definition | arity | 1.540 | baseline | p95: 2.317 ms; samples: 3000; empty: 0; returned items: 1–1; result bytes: 166–166; stale responses: 0 |
| Edit to definition | languageserver | 38.607 | 25.07× arity | p95: 95.213 ms; samples: 3000; empty: 0; returned items: 1–1; result bytes: 166–166; stale responses: 18 |
| Edit to definition | ark | 3.666 | 2.38× arity | p95: 4.945 ms; samples: 3000; empty: 0; returned items: 1–1; result bytes: 274–274; stale responses: 0 |
Resident memory ​
{"kind":"bar","points":[{"detail":"PSS: 24.1 MiB; processes: 1","document":"Initialized","ratio":1.0,"ratio_label":"baseline","tool":"arity","value":25.9},{"detail":"PSS: 899.3 MiB; processes: 9","document":"Initialized","ratio":40.57915057915058,"ratio_label":"40.58× arity","tool":"languageserver","value":1051.0},{"detail":"PSS: 111.0 MiB; processes: 1","document":"Initialized","ratio":4.6061776061776065,"ratio_label":"4.61× arity","tool":"ark","value":119.3},{"detail":"PSS: 316.5 MiB; processes: 1","document":"Files open","ratio":1.0,"ratio_label":"baseline","tool":"arity","value":318.3},{"detail":"PSS: 1526.8 MiB; processes: 14","document":"Files open","ratio":5.569588438579956,"ratio_label":"5.57× arity","tool":"languageserver","value":1772.8},{"detail":"PSS: 116.0 MiB; processes: 1","document":"Files open","ratio":0.3901979264844486,"ratio_label":"0.39× arity","tool":"ark","value":124.2},{"detail":"PSS: 339.7 MiB; processes: 1","document":"After edits","ratio":1.0,"ratio_label":"baseline","tool":"arity","value":341.6},{"detail":"PSS: 823.6 MiB; processes: 3","document":"After edits","ratio":2.5401053864168617,"ratio_label":"2.54× arity","tool":"languageserver","value":867.7},{"detail":"PSS: 124.3 MiB; processes: 1","document":"After edits","ratio":0.3890515222482436,"ratio_label":"0.39× arity","tool":"ark","value":132.9},{"detail":"PSS: 359.8 MiB; processes: 2","document":"Sampled peak","ratio":1.0,"ratio_label":"baseline","tool":"arity","value":361.6},{"detail":"PSS: 1779.4 MiB; processes: 15","document":"Sampled peak","ratio":5.6009402654867255,"ratio_label":"5.60× arity","tool":"languageserver","value":2025.3},{"detail":"PSS: 124.3 MiB; processes: 2","document":"Sampled peak","ratio":0.36753318584070793,"ratio_label":"0.37× arity","tool":"ark","value":132.9}],"ratio_title":"Memory relative to arity","value_title":"Median RSS (MiB)"}
Data table
| Measurement | Server | Median RSS (MiB) | Relative | Details |
|---|---|---|---|---|
| Initialized | arity | 25.900 | baseline | PSS: 24.1 MiB; processes: 1 |
| Initialized | languageserver | 1051.000 | 40.58× arity | PSS: 899.3 MiB; processes: 9 |
| Initialized | ark | 119.300 | 4.61× arity | PSS: 111.0 MiB; processes: 1 |
| Files open | arity | 318.300 | baseline | PSS: 316.5 MiB; processes: 1 |
| Files open | languageserver | 1772.800 | 5.57× arity | PSS: 1526.8 MiB; processes: 14 |
| Files open | ark | 124.200 | 0.39× arity | PSS: 116.0 MiB; processes: 1 |
| After edits | arity | 341.600 | baseline | PSS: 339.7 MiB; processes: 1 |
| After edits | languageserver | 867.700 | 2.54× arity | PSS: 823.6 MiB; processes: 3 |
| After edits | ark | 132.900 | 0.39× arity | PSS: 124.3 MiB; processes: 1 |
| Sampled peak | arity | 361.600 | baseline | PSS: 359.8 MiB; processes: 2 |
| Sampled peak | languageserver | 2025.300 | 5.60× arity | PSS: 1779.4 MiB; processes: 15 |
| Sampled peak | ark | 132.900 | 0.37× arity | PSS: 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.
curl --proto '=https' --tlsv1.2 -sSf https://arity.cc/install | sh
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:
cargo install arity
Homebrew ​
On macOS or Linux:
brew install jolars/tap/arity
npm ​
The arity-cli package bundles a prebuilt binary:
npm install -g arity-cli
PyPI ​
Install the binary as a Python tool:
uv tool install arity
Alternatively, use pipx install arity.
Arch Linux ​
Install the prebuilt
arity-bin package with an AUR
helper:
paru -S arity-bin
Nix ​
Arity is available as arity in
Nixpkgs. For a
shell with Arity available:
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:
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:
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:
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:
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:
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 ​
- Format consistently. Format R code, roxygen documentation, and package
DESCRIPTIONfiles. - Find problems early. Catch common mistakes, apply safe fixes, and run the same checks locally and in CI.
- Work in your editor. Get completions, diagnostics, navigation, and refactoring through the language server, with formatting on save.
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 ​
- VS Code or Positron: install the Arity extension. It includes the binary and starts the language server for you.
- RStudio: use the R package to format code inside RStudio or from the R console.
- Other editors: follow Editor setup to connect your editor to the language server. The guide includes Neovim, Zed, and Helix.
- Terminal or CI: install the CLI, then follow Getting started to check and format an existing R project.
The Installation page covers the standalone installer, package managers, and source builds.
Where to go next ​
- Getting started: a workflow for an existing R project.
- Formatting and Linting: use each tool on files, projects, and standard input.
- Configuration: share project settings in
arity.toml. - Integrations: run checks in CI or a pre-commit hook.
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. With stdin, write fixed source to stdout; cannot combine with --output json
--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.
add <- function(x, y = 1) {
x + y
}
becomes
#' 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):
#' Add two numbers
#'
#' @param x A number.
add <- function(x, y = 1) {
x + y
}
becomes
#' 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:
{
"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:
#: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.
This applies to file arguments and recursive walks. Nested configs replace
ancestor configs unless they use extend. Stdin uses the working directory,
even with --stdin-filename.
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:
--config <PATH>loads an explicit file and skips project discovery andARITY_CONFIG.--no-configignores all config files, includingARITY_CONFIG, and uses the built-in defaults.
In VS Code or Positron, set the variable in your user settings.json, then run
Arity: Restart Server:
{
"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, anchored alongside
those patterns.
During directory walks, each directory's config controls its entries. Nested configs can change exclusions within their directories. Excluded directories are not searched, so configs inside them have no effect. Naming a directory explicitly starts a walk using that directory's nearest config.
# 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.
[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. |
per-file-ignores |
table of glob → rule IDs | {} |
Rule IDs to disable in matching files. |
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.
[lint]
extend-select = ["undesirable-function"]
ignore = ["unused-binding"]
[lint.per-file-ignores] ​
Disable selected rules for matching files while keeping other checks active:
[lint.per-file-ignores]
"sess/inst/tinytest/**" = ["undefined-symbol"]
"**/helpers.R" = ["unused-binding"]
Keys are file globs and values are arrays of exact rule IDs. Unknown IDs are lint-time errors, even when no file matches the pattern. Invalid globs are configuration errors.
Use forward slashes on every platform. Patterns without a slash, such as
helpers.R or *.R, match basenames in any directory. Relative patterns with a
slash match from the selected config file's directory, including an explicit
--config or an ARITY_CONFIG fallback. * and ? match within one path
component; ** crosses directories. For example, tests/*.R matches direct
children and tests/** includes nested files.
All matching entries contribute ignores. Their order and specificity do not
affect the result. A leading ! complements that entry's pattern:
[lint.per-file-ignores]
"!R/**" = ["unused-binding"] # ignore this rule outside R/
Negation never re-enables a rule ignored by another entry. With extend, the
tables merge by glob: a child's array replaces the inherited array for the same
glob, while other entries remain. An empty array clears that entry. The selected
config file anchors inherited globs, just as it anchors inherited excludes.
File ignores apply to recursive walks, explicitly named files, CLI fixes, and
language-server diagnostics and fixes. With stdin, --stdin-filename supplies
the matching path; omitting it applies no file ignores. Config discovery still
starts from the working directory for stdin.
Both R and DESCRIPTION rules support file ignores. Files remain part of
project analysis, and parse errors are always reported. syntax-error is not a
selectable rule and cannot appear in this table. Declared globals and framework
environments are separate semantic inputs.
[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.
[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.
[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.
[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_URLenvironment variable, never committed in a sharedarity.toml.
Note: the same applies to the attach probe (
arity index --attach-probe), which observes what a meta-package attaches by runninglibrary()in a fresh R session. Because that executes package attach hooks, it is enabled per run by the flag or per user via theARITY_ATTACH_PROBEenvironment variable, never fromarity.toml. Without it, attach sets are still captured for packages following the tidyversecoreconvention, 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):
[format].indent-style("space"or"tab")---tab indentation.[format].skipand a# fmt: skipcomment---opt specific calls out of formatting.severityin a[lint.rules.<id>]table---overriding a rule's severity.- Category names (e.g.
"correctness") inselect,extend-select, orignore.
Directives ​
A directive is an ordinary # comment that tells arity to stand down. One
grammar covers the formatter, the linter, and both at once:
# 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.
# 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:
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:
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:
# 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.
# 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.
# 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:
# 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:
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 ​
- One rule per directive. There is no comma-separated list:
# arity-lint skip a, breads the rule ID asa,and suppresses neither. Write a separate comment per rule.misnamed-suppressioncatches the mistake. - The formatter acts on whole statements. A
# arity-formatdirective is honored at the top level and in a block body — the places where whole lines can be handed back untouched. Between two call arguments it is inert;misplaced-suppressionsays so. A lint directive has no such limit: it attaches by node. - A format region does not leave its block. An unclosed
# arity-format offinside{ ... }ends at the closing brace. A lint region is a byte range and runs on untilonor end of file. - Syntax errors cannot be suppressed. A file that does not parse is reported
before any rule runs, so
# arity-lint skip syntax-errorhas no effect (and is itself flagged as a misnamed rule). metafindings need the file-wide form. A finding about a directive is spanned on a comment, and askipattaches past comments to the next piece of code — so it can never land on the directive above it. Use# arity-lint skip-file <meta-rule>: <reason>, or turn the rule off in configuration with[lint] ignore.- A bare
# arityneeds a verb.# arity is greatis prose, not a typo'd directive, so it is left alone rather than reported. The prefixed forms are unambiguous and are checked. - Roxygen lines are not directives.
#' arity-lint …is documentation content, not a directive.
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:
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:
[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:
total <- subtotal
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:
lenth(1:3)
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:
x <- 1
y <- 2
print(y)
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:
f <- function(x, x) x
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:
list(a = 1, a = 2)
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 ==:
x == NA
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:
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:
if (x == NaN) handle_nan()
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:
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:
if (x == NULL) handle_null()
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:
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:
paste("a", , "b")
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:
list(1,)
c(value = )
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:
rep(x, times = 2, length.out = 10)
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:
label <- sprintf("ready: 100%%")
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:
label <- "ready: 100%"
Zero padding of strings depends on the platform:
label <- sprintf(f = "%05s", "x")
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:
label <- gettextf("%0*s", 5, "x", domain = NA)
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:
if (a & b) {
go()
}
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:
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:
f <- function() {
return(1)
2
}
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:
f <- function() {
if (x) return(1) else return(2)
3
}
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:
if (is.numeric(x) || is.integer(x)) mean(x)
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:
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:
if (TRUE) {
f()
} else {
g()
}
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:
x <- {}
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:
download.file(url, destfile)
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":
download.file(url, destfile, method = "curl", mode = "wb")
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 ::::
utils:::.getHelpFile(path)
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):
y <- c(1, 2) |> sum()
print(y)
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:
if (x = 5) print(x)
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:
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:
mean(x <- 1:10)
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:
f <- function(x) {
browser()
x + 1
}
warning: browser
--> example.R:2:3
|
2 | browser()
| ^^^^^^^^^ leftover `browser()` debugging call
= help: Remove the `browser()` call.
After applying the fix:
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:
c <- function(x, y) x
c(2, 3)
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:
if (ready == TRUE) go()
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:
flag <- ifelse(cond, TRUE, FALSE)
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:
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:
if (all.equal(actual, expected)) pass()
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:
f <- function(x) {
x %>% sum() %>% return()
FALSE
}
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:
f <- function() {
return
42
}
f()
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:
f <- function() return(result <- compute())
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:
lapply(x, length) > 1
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:
read_file <- function(path) {
con <- file(path)
print(readLines(con))
close(con)
}
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:
data.frame(label = c("a", "b"))
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:
f <- function(alpha) alpha
f(al = 1)
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:
с <- 1
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:
pаyload <- 1
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:
while (TRUE) {
poll()
}
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:
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:
attach(mtcars)
mean(mpg)
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:
for (x in x) {
print(x)
}
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:
for (i in seq_along(i)) {
print(i)
}
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:
for (i in 1:10) {
for (i in 1:5) {
print(i)
}
}
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:
#' Add one
#'
#' @export
add_one <- function(x) {
x + 1
}
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:
calc <- function(x) {
x + 1
}
calc <- function(x) {
x * 2
}
calc(3)
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:
process <- function(data) {
clean <- function(x) x[!is.na(x)]
clean <- function(x) x[x > 0]
clean(data)
}
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:
x <- T
y <- F
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:
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:
if (!(a == b)) stop()
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:
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:
if (any(!ok)) stop()
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:
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:
grepl("^abc", x)
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:
if (a) {
if (b) {
do_thing()
}
}
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:
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()
}
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:
if (any(is.na(x))) stop()
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:
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:
if (any(duplicated(x))) stop()
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:
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:
y <- if (is.null(x)) default else x
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:
a <- t(x) %*% y
b <- x %*% t(y)
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:
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:
n <- sapply(x, length)
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:
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:
keep <- x[nchar(x) > 0]
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.
Also flag seq(length(x)) when both callees resolve to base R and each call has exactly one positional argument. For ordinary vectors, seq_along(x) agrees on nonempty input and returns integer(0) on empty input instead of c(1L, 0L). This fix is unsafe because a custom length method can return a classed count that dispatches a seq method. It requires --unsafe-fixes and is withheld when seq_along could be shadowed or comments would be lost. Qualified calls, named arguments, extra or missing arguments, pipe stages, and arbitrary seq(x) are left alone.
This rule is enabled by default.
Ranges over a vector's indices and up to a count:
for (i in 1:length(x)) print(x[i])
for (j in 1:n) f(j)
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:
for (i in seq_along(x)) print(x[i])
for (j in seq_len(n)) f(j)
A seq call over a possibly-empty vector's length:
seq(length(numeric(0)))
warning: seq
--> example.R:1:1
|
1 | seq(length(numeric(0)))
| ^^^^^^^^^^^^^^^^^^^^^^^ `seq(length(numeric(0)))` counts down (`1:0`) when the length is zero; `seq_along(numeric(0))` handles empty input
= help: Use `seq_along(numeric(0))`.
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:
if (class(x) == "factor") levels(x)
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:
grepl("abc", x)
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:
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:
smallest <- sort(x)[1]
largest <- sort(x, decreasing = TRUE)[1]
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:
totals <- apply(x, 1, sum)
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:
i <- which(grepl("^a", x))
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:
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:
y <- rep(x, length.out = n)
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:
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:
p <- system.file(file.path("a", "b"), package = "pkg")
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:
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:
df <- do.call(cbind.data.frame, x)
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:
n <- length(levels(x))
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:
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:
if (length(which(ok)) == 0) stop()
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:
#' Add one
#' @exprot
add_one <- function(x) x + 1
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:
#' @param x A number.
#' @export
add_one <- function(x) x + 1
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:
#' Add one
#' @param x A number.
#' @export
add_one <- function(x) x + 1
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:
#' Add two numbers
#' @param x The first number.
#' @param z The other one.
#' @export
add <- function(x, y) x + y
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:
#' Add one
#' @examples
#' add_one(1
#' @export
add_one <- function(x) x + 1
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):
#' Add one
#' @inheritParams other -verbose
add_one <- function(x) x + 1
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:
summarize <- function(data) {
dplyr::group_by(data, id)
}
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:
f <- function(x) .Call("native_fun", x)
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:
Package: mypkg
Version: 0.1.0
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:
Package: mypkg
Version: 0.1.0
License: MIT + file LICENSE
Version: 0.2.0
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:
Package: mypkg
Version: 0.1.0
Suggest: testthat
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:
Package: mypkg
Depends: R (4.1)
Imports: dplyr (1.0.0)
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:
Package: mypkg
Imports: dplyr (>= latest)
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:
Package: mypkg
Version: 0.1.0
Imports: dplyr, rlang
Suggests: dplyr, testthat
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:
Package: my_pkg
Version: 0.1.0
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:
Package: stats
Version: 0.1.0
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:
Package: mypkg
Version: 1.0.0-beta
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:
Package: mypkg
Version: 1.01
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:
Package: mypkg
Version: 1.0.5000
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:
Package: mypkg
Version: 0.1.0
Maintainer: Jane Doe
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:
Package: mypkg
Version: 0.1.0
Maintainer: Jane Doe <jane@example.com>, John Roe <john@example.org>
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:
Package: mypkg
Version: 0.1.0
Maintainer: Doe, Jane <jane@example.com>
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:
Package: mypkg
Title: Model Fitting.
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:
Package: mypkg
Title: mypkg: Model Fitting
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:
Package: mypkg
Title: Model Fitting
Description: This package calls 'fit_model()'
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:
Package: mypkg
Title: Model Fitting
Description: See https://example.com for details.
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:
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:
Package: mypkg
Date: 09/11/2026
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:
Package: mypkg
License: GPL 2.0
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:
Package: mypkg
License: GPL-2
A version restriction that selects no known license:
Package: mypkg
License: GPL (>= 99)
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:
Package: mypkg
Version: 0.1.0
Title: A 日本語 package
License: MIT
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:
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:
Package: mypkg
Version: 0.1.0
Authors@R: person("Jane", "Doe", role = c("aut", "cre"))
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:
Package: mypkg
Version: 0.1.0
Authors@R: person("Jane", "Doe", role = c("aut", "cre"), email = "invalid")
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:
Package: mypkg
Version: 0.1.0
Authors@R: c(
person("Jane", "Doe", , "jane@example.com", c("aut", "cre")),
person("John", "Roe")
)
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:
Package: mypkg
Version: 0.1.0
Authors@R: person("Jane", "Doe", , "jane@example.com", c("aut", "cre"),
comment = c(ORCID = "0000-0002-1825-0098"))
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:
Package: mypkg
Version: 0.1.0
Author: person("Jane", "Doe", role = c("aut", "cre"))
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:
Package: mypkg
Version: 0.1.0
Authors@R: c(
person("Jane", "Doe", , "jane@example.com", c("aut", "cre")),
person()
)
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:
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>
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:
Package: mypkg
Title: Statistical methods for data analysis
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:
Package: mypkg
Title: fitting models with 'mixed-effects software'
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:
Package: mypkg
Version: 0.1.0
Collate: 'a.R' 'missing.R' 'a.R'
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"):
Package: mypkg
Version: 0.1.0
Imports: rlang, tibble
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:
# arity-lint skip unusd-binding: leftover from a refactor
x <- 1
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:
# arity-lint skip unused-binding: leftover from a refactor
x <- 1
A comma-separated list is not supported — write one directive per rule:
# arity-lint skip browser, repeat: debugging
x <- 1
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:
# arity-lint skip-file: generated by a script
x <- 1
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:
# arity-lint skip
x <- 1
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:
f(
a = 1,
# arity-format skip: hand-aligned
b = 2
)
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:
# arity off
x <- 1
# arity-lint on
y <- 2
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:
# arity-ignore unused-binding: part of the documented API
config <- list(width = 80)
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:
# arity-lint skip unused-binding: part of the documented API
config <- list(width = 80)
…and of # arity-lint skip-file:
# arity-ignore-file unused-binding: generated by tools/codegen.R
x <- 1
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:
# 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:
# arity-lint skip unused-binding
x <- 1
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:
# arity-lint skip unused-binding: no longer needed
x <- 1
print(x)
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:
x <- 1
print(x)