This document describes how linting works in this repository, how to install the required tools, and how to troubleshoot common failures.
Run all linters with:
./scripts/lint.shThis is the preferred command for local validation before committing or opening a pull request.
The repository also provides a pre-commit wrapper:
./scripts/pre-commit.shFor now this script delegates directly to ./scripts/lint.sh.
A tracked Git hook is included at .githooks/pre-commit and runs
./scripts/pre-commit.sh automatically before git commit.
Enable the tracked hooks once per local clone:
git config core.hooksPath .githooksAfter that, git commit will execute the repository's pre-commit checks
automatically.
The script runs these linters in order:
linter markdown
linter yaml
linter cspell
linter shellcheckIt stops on the first failure.
- Markdown using
.markdownlint.json - YAML using
.yamllint-ci.yml - Spelling using
cspell.jsonandproject-words.txt - Shell scripts using ShellCheck
Install the Rust wrapper used by the script:
cargo install torrust-linting --lockedInstall system tools:
sudo apt-get update
sudo apt-get install -y yamllint shellcheckThe linter command may try to install Node-based tools automatically, but in
practice it is more reliable to install them explicitly in a user-writable npm
prefix.
Example setup:
export NPM_CONFIG_PREFIX="$HOME/.local"
export PATH="$HOME/.local/bin:$PATH"
npm install -g markdownlint-cli cspell@8.17.5If you want those settings permanently, add the two export lines to your
shell profile.
Run this before committing:
export NPM_CONFIG_PREFIX="$HOME/.local"
export PATH="$HOME/.local/bin:$PATH"
./scripts/pre-commit.shIf the script passes, the repository is clean for Markdown, YAML, spelling, and shell script linting.
You can run individual linters through the same wrapper:
linter markdown
linter yaml
linter cspell
linter shellcheckThis is useful when fixing one class of failures at a time.
The Rust wrapper is not installed.
Fix:
cargo install torrust-linting --lockedThe wrapper may try to install npm packages globally under /usr/local, which
fails for non-root users.
Fix: use a user-local npm prefix.
export NPM_CONFIG_PREFIX="$HOME/.local"
export PATH="$HOME/.local/bin:$PATH"Then rerun ./scripts/lint.sh.
At the time this document was written, the latest cspell release required
Node.js >=22.18.0, while this repository workflow was being run with Node 20.
Fix options:
- Upgrade Node.js to a compatible version.
- Or install a Node 20-compatible cspell version explicitly:
npm install -g cspell@8.17.5The wrapper may try to install yamllint itself.
Preferred fix: install it manually ahead of time.
sudo apt-get install -y yamllintInstall it explicitly:
sudo apt-get install -y shellcheckAdd the term to project-words.txt, one word per line, then rerun the linter.
Examples already added during recent documentation work include:
Mailguntulpn
Markdown linting is strict about formatting details such as tab characters. Use spaces for wrapped list items and paragraph continuations.
- scripts/lint.sh
- scripts/pre-commit.sh
- .githooks/pre-commit
- project-words.txt
- cspell.json
- .markdownlint.json
- .yamllint-ci.yml
./scripts/lint.shis the canonical repository command../scripts/pre-commit.shis the hook-friendly entry point for commit-time checks.- If you document new product names, services, or command tokens, update
project-words.txtas part of the same change. - Run the full script again after fixing targeted issues to ensure the complete repository still passes.