Torrust Linting
A unified linting library and CLI for Torrust projects. Provides a single binary that runs all project linters consistently across the organization.
Features
- Multiple Linters: Markdown, YAML, TOML, Rust (clippy + rustfmt), shell scripts, and spell checking
- CLI Ready: Pre-built CLI binary (
linter) with subcommands for each linter - Library: Use individual linter functions in your own Rust code or build a custom CLI
- Extensible: Easy to add new linters
- Auto-install: Automatically installs missing tools (npm-based, system package manager)
Usage
As a binary
Run the linter binary directly:
As a library dependency
Add to your Cargo.toml:
[]
= "0.1.0"
Option 1: Use the complete CLI (easiest)
use Result;
Option 2: Custom CLI implementation
use Result;
use Parser;
use ;
Option 3: Use individual linters programmatically
use Result;
use ;
See the examples/ directory for more usage patterns.
External tools required
Some linters delegate to external tools. The library will attempt to install missing tools automatically, but you can also install them manually:
| Linter | Tool | Install |
|---|---|---|
| Markdown | markdownlint |
npm install -g markdownlint-cli |
| YAML | yamllint |
apt install yamllint / pip3 install yamllint |
| TOML | taplo |
cargo install taplo-cli --locked |
| Spell check | cspell |
npm install -g cspell |
| Shell | shellcheck |
apt install shellcheck |
| Rust | cargo clippy, cargo fmt |
bundled with rustup |
Configuration files expected in the project root
The linters read configuration from well-known files in the working directory:
| File | Used by |
|---|---|
.markdownlint.json |
markdownlint |
.yamllint-ci.yml |
yamllint |
.taplo.toml |
taplo |
cspell.json |
cspell |
License
Copyright (c) 2026 Torrust. See LICENSE.