Metadata-Version: 2.4
Name: arity
Version: 0.14.0
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Rust
Classifier: Topic :: Software Development :: Quality Assurance
Classifier: Topic :: Software Development
License-File: LICENSE
Summary: A language server, formatter, and linter for R
Keywords: r,language-server,formatter,linter
Home-Page: https://arity.cc
Author-email: Johan Larsson <johan@jolars.co>
License: MIT
Requires-Python: >=3.10
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Homepage, https://arity.cc
Project-URL: Repository, https://github.com/jolars/arity

# Arity <img src='https://raw.githubusercontent.com/jolars/arity/refs/heads/main/images/logo.png' align="right" width="139" />

[![Build and
Test](https://github.com/jolars/arity/actions/workflows/build-and-test.yml/badge.svg)](https://github.com/jolars/arity/actions/workflows/build-and-test.yml)
[![Crates.io](https://img.shields.io/crates/v/arity.svg?logo=rust)](https://crates.io/crates/arity)
[![Open
VSX](https://img.shields.io/open-vsx/v/jolars/arity?logo=vsix)](https://open-vsx.org/extension/jolars/arity)
[![VS
Code](https://vsmarketplacebadges.dev/version-short/jolars.arity.svg?logo=vsix)](https://marketplace.visualstudio.com/items?itemName=jolars.arity)
[![PyPI
version](https://badge.fury.io/py/arity.svg?icon=si%3Apython)](https://pypi.org/project/arity/)
[![npm
version](https://badge.fury.io/js/@arity-cli%2Farity-cli.svg?icon=si%3Anpm)](https://www.npmjs.com/package/arity-cli)

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](https://github.com/jolars/arity/releases)
- **VS Code/Open VSX**: the **Arity** extension (also works in Positron)
- **Arch Linux**: `pacman -S arity-bin` (or `arity`) (from the AUR:
  [`arity-bin`](https://aur.archlinux.org/packages/arity-bin/),
  [`arity`](https://aur.archlinux.org/packages/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](https://arity.cc/reference/configuration.html) 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](https://arity.cc/guide/editors.html).

## Pre-commit hook

[arity-pre-commit](https://github.com/jolars/arity-pre-commit) provides
[pre-commit](https://pre-commit.com) hooks for linting and formatting. It
installs a prebuilt binary wheel from PyPI, so no Rust toolchain or R
installation is required:

```yaml
repos:
  - repo: https://github.com/jolars/arity-pre-commit
    # arity version
    rev: v0.13.0
    hooks:
      # Lint .R files
      - id: arity-lint
      # Format the same files in place
      - id: arity-format
```

## GitHub Actions

[arity-action](https://github.com/jolars/arity-action) installs arity and runs
format and lint checks in CI:

```yaml
jobs:
  arity:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - uses: jolars/arity-action@v1
```

## Acknowledgements

The core architecture of Arity is entirely based on
[rust-analyzer](https://github.com/rust-lang/rust-analyzer), using salsa for
incremental computation and rowan for lossless syntax trees. Arity also owes a
great debt to [air](https://posit-dev.github.io/air/), on which it is heavily
inspired and from which it has borrowed tests, rules, and formatting style. It
is also inspired by [jarl](https://jarl.etiennebacher.com/) and has borrowed
rules from it as well as some of its architecture.

## Documentation

Full documentation lives at [arity.cc](https://arity.cc):

- [Getting started](https://arity.cc/getting-started.html)
- [Editor setup](https://arity.cc/guide/editors.html)
- [Configuration](https://arity.cc/reference/configuration.html)
- [CLI reference](https://arity.cc/reference/cli.html)
- [Lint rules](https://arity.cc/reference/rules.html)

