From a1c06e39dace210df1796759501f9076578edb0d Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Mon, 8 Jun 2026 12:59:57 +0200 Subject: [PATCH] ci: add `.pre-commit-config.yaml` (#164) * ci: add .pre-commit-config.yaml * Make debian/rules executable --- .pre-commit-config.yaml | 48 +++++++++++++++++++++++++++++++++++++++++ debian/rules | 0 2 files changed, 48 insertions(+) create mode 100644 .pre-commit-config.yaml mode change 100644 => 100755 debian/rules diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..7a1457f --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,48 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +exclude: ^fuzz/corpus/ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v6.0.0 + hooks: + - id: check-added-large-files + - id: check-executables-have-shebangs + - id: check-json + exclude: '\.vscode/(cSpell|extensions)\.json' # cSpell.json and extensions.json use comments + - id: check-shebang-scripts-are-executable + exclude: '.+\.rs' # would be triggered by #![some_attribute] + - id: check-symlinks + - id: check-toml + - id: check-yaml + args: [ --allow-multiple-documents ] + - id: destroyed-symlinks + - id: end-of-file-fixer + - id: mixed-line-ending + args: [ --fix=lf ] + - id: trailing-whitespace + + - repo: local + hooks: + - id: rust-linting + name: Rust linting + description: Run cargo fmt on files included in the commit. + entry: cargo +stable fmt -- + pass_filenames: true + types: [file, rust] + language: system + - id: rust-clippy + name: Rust clippy + description: Run cargo clippy on files included in the commit. + entry: cargo +stable clippy --workspace --all-targets --all-features -- -D warnings + pass_filenames: false + types: [file, rust] + language: system + - id: cspell + name: Code spell checker (cspell) + description: Run cspell to check for spelling errors (if available). + entry: bash -c 'if command -v cspell >/dev/null 2>&1; then cspell --no-must-find-files -- "$@"; else echo "cspell not found, skipping spell check"; exit 0; fi' -- + pass_filenames: true + language: system + +ci: + skip: [rust-linting, rust-clippy, cspell] diff --git a/debian/rules b/debian/rules old mode 100644 new mode 100755