# Pre-commit Configuration # Configures git pre-commit hooks for the website-impl project repos: # ============================================================================ # Ontology Hooks # ============================================================================ - repo: local hooks: - id: manifest-coverage name: Manifest capability completeness entry: bash -c 'ONTOREF_PROJECT_ROOT="$(pwd)" ontoref sync manifest-check' language: system files: (\.ontology/|reflection/modes/|reflection/forms/).*\.ncl$ pass_filenames: false stages: [pre-commit] # ============================================================================ # Rust Hooks # ============================================================================ - repo: local hooks: - id: rust-fmt name: Rust formatting (cargo +nightly fmt) entry: bash -c 'cargo +nightly fmt --all' language: system types: [rust] pass_filenames: false stages: [pre-commit] - id: rust-clippy name: Rust linting (cargo clippy) entry: bash -c 'cargo clippy --lib --bins 2>&1 | grep -i warning || true' language: system types: [rust] pass_filenames: false stages: [pre-commit] - id: rust-test name: Rust tests entry: bash -c 'cargo test --workspace' language: system types: [rust] pass_filenames: false stages: [pre-push] - id: rustelo-deps-sync name: Rustelo deps sync (registry + overlay → workspace.dependencies) # Fails (exit 1) if [workspace.dependencies] drifted from # ../rustelo/registry/dependencies.toml combined with the local # rustelo-deps-overlay.toml. Requires the rustelo repo checked out # as a sibling directory. entry: >- bash -c 'test -d ../rustelo/xtask || { echo "rustelo-deps-sync: ../rustelo/xtask not found — clone rustelo as sibling dir" >&2; exit 2; }; CARGO_TARGET_DIR="${CARGO_TARGET_DIR:-target/xtask}" cargo run --manifest-path ../rustelo/xtask/Cargo.toml --quiet -- sync-deps --check --rustelo-root ../rustelo --target .' language: system files: '^(Cargo\.toml|rustelo-deps-overlay\.toml)$' pass_filenames: false stages: [pre-commit] # ============================================================================ # General Pre-commit Hooks # ============================================================================ - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.5.0 hooks: - id: check-added-large-files args: ['--maxkb=1000'] - id: check-merge-conflict - id: check-toml - id: check-yaml - id: end-of-file-fixer - id: trailing-whitespace exclude: \.md$