npm.io
0.8.0 • Published yesterdayCLI

arity-cli

Licence
MIT
Version
0.8.0
Deps
0
Size
6 kB
Vulns
0
Weekly
0
Stars
17

Arity

Build and
Test Crates.io License: MIT

Arity is a language server, formatter, and linter for the R programming language, built in Rust on a lossless, incremental parser. It provides a fast, deterministic development experience that integrates with popular code editors and IDEs.

  • Formatter: deterministic, rule-based formatting toward the tidyverse style guide, with idempotent output and roxygen support.
  • Linter: a growing set of correctness, readability, and performance rules, many with safe autofixes.
  • Language server: formatting, diagnostics with quick fixes, hover, completion, signature help, go-to-definition and references, rename, document and workspace symbols, semantic tokens, folding, and call hierarchy.

Runs on Linux, macOS, and Windows (x86_64 and arm64).

Installation

Arity is available from several sources:

  • crates.io: cargo install arity
  • npm: npm install -g arity-cli (bundles a prebuilt binary)
  • PyPI: uv tool install arity/pipx install arity
  • Prebuilt binaries: from the releases page
  • VS Code/Open VSX: the Arity extension (also works in Positron)

From npm

Install with npx or npm:

# One-shot run, no install:
npx arity-cli format file.R

# Persistent install:
npm install -g arity-cli

The package detects your platform at install time and pulls in a prebuilt binary via npm's optional dependencies; no Rust toolchain required.

From crates.io

If you have Rust installed:

cargo install arity

Formatter

To format your code, you can use:

  • arity format [file]
  • arity format --verify [file]
  • arity format --check <path> [<path> ...]

Linter

To lint your code, you can use:

  • arity lint <path> [<path> ...]

arity lint reads from stdin when given no paths, and exits non-zero when it reports any findings.

Configuration

Arity reads an optional arity.toml, discovered by walking up from each file's directory to the repository root. Run arity init to scaffold a commented starter file. See the configuration reference for every key.

Editor integration

arity lsp starts a stdio-based language server offering formatting, diagnostics with quick fixes, hover, completion, signature help, go-to-definition and references, rename, document and workspace symbols, semantic tokens, folding, and call hierarchy.

The Arity extension for VS Code/Open VSX (and Positron) bundles the binary and starts the server automatically. For Neovim, Helix, and other editors, see the editor setup guide.

Acknowledgements

The core architecture of Arity is entirely based on rust-analyzer, using salsa for incremental computation and rowan for lossless syntax trees. Arity also owes a great debt to air, on which it is heavily inspired and from which it has borrowed tests, rules, and formatting style. It is also inspired by jarl and has borrowed rules from it as well as some of its architecture.

Documentation

Full documentation lives at arity.cc:

Keywords