Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Linting and formatting

We employ a variety of linting and formatting tools. They can be run manually or with Lūn.

Lūn

To run all the linters and formatters:

lun run

As a pre-commit hook:

cat <<'EOF' > .git/hooks/pre-commit
#!/usr/bin/env bash
lun run --check --staged
EOF
chmod +x .git/hooks/pre-commit

Clippy

We lint Rust code with Clippy.

You can install Clippy with rustup like so:

rustup component add clippy

and run it like this:

cargo clippy --all-targets -- --deny warnings

Generic scripts

We have a few Python scripts in scripts/lint/ that perform one-off checks. They generally take some number of paths as arguments. Use their --help options to learn more.

mdlynx

We run mdlynx on our Markdown files to check for broken links.

git ls-files -z --exclude-standard '*.md' | xargs -0 mdlynx

Ruff

We lint and format Python code with Ruff.

git ls-files -z --exclude-standard '*.py' | xargs -0 ruff format
git ls-files -z --exclude-standard '*.py' | xargs -0 ruff check

rustfmt

We format Rust code with rustfmt.

You can install rustfmt with rustup like so:

rustup component add rustfmt

and then run it like this:

cargo fmt --all

ShellCheck

We lint shell scripts with ShellCheck.

git ls-files -z --exclude-standard '*.sh' | xargs -0 shellcheck

taplo

We format TOML files with taplo.

git ls-files -z --exclude-standard '*.toml' | xargs -0 taplo format

ttlint

We lint text files with ttlint.

git ls-files -z --exclude-standard '**' | xargs -0 ttlint

ty

We lint Python code with ty.

git ls-files -z --exclude-standard '*.py' | xargs -0 ty

typos

We run typos on Markdown files.

git ls-files -z --exclude-standard '*.md' | xargs -0 typos

zizmor

We lint our GitHub Actions files with zizmor.

zizmor .github