A unified linting library and CLI for Torrust projects. Provides a single binary that runs all project linters consistently across the organization.
- 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)
Run the linter binary directly:
cargo run # Run all linters (default)
cargo run -- markdown # Run markdown linter
cargo run -- yaml # Run YAML linter
cargo run -- toml # Run TOML linter
cargo run -- cspell # Run CSpell spell checker
cargo run -- clippy # Run Rust clippy linter
cargo run -- rustfmt # Run Rust formatter check
cargo run -- shellcheck # Run ShellCheck linter
cargo run -- all # Run all lintersAdd to your Cargo.toml:
[dependencies]
torrust-linting = "0.1.0"use anyhow::Result;
fn main() -> Result<()> {
torrust_linting::run_cli()
}use anyhow::Result;
use clap::Parser;
use torrust_linting::{Cli, execute_command, init_tracing};
fn main() -> Result<()> {
init_tracing();
let cli = Cli::parse();
execute_command(cli.command.as_ref())?;
Ok(())
}use anyhow::Result;
use torrust_linting::{run_rustfmt_linter, run_clippy_linter, run_all_linters};
fn main() -> Result<()> {
run_rustfmt_linter()?;
run_clippy_linter()?;
// Or run everything at once:
run_all_linters()?;
Ok(())
}See the examples/ directory for more usage patterns.
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 |
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 |
Copyright (c) 2026 Torrust. See LICENSE.