2025-12-24 03:26:41 +00:00
|
|
|
# Pre-commit hooks for TypeDialog project
|
|
|
|
|
# Install: pre-commit install
|
|
|
|
|
# Run manually: pre-commit run --all-files
|
|
|
|
|
|
|
|
|
|
repos:
|
|
|
|
|
# General file checks
|
|
|
|
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
|
|
|
rev: v5.0.0
|
|
|
|
|
hooks:
|
|
|
|
|
- id: trailing-whitespace
|
|
|
|
|
exclude: '\.md$'
|
|
|
|
|
- id: end-of-file-fixer
|
|
|
|
|
- id: check-yaml
|
|
|
|
|
exclude: '.gitlab-ci.yml'
|
|
|
|
|
- id: check-toml
|
|
|
|
|
- id: check-json
|
|
|
|
|
- id: check-added-large-files
|
|
|
|
|
args: ['--maxkb=1024']
|
|
|
|
|
- id: check-merge-conflict
|
|
|
|
|
- id: mixed-line-ending
|
|
|
|
|
args: ['--fix=lf']
|
|
|
|
|
|
|
|
|
|
# Rust formatting
|
|
|
|
|
- repo: local
|
|
|
|
|
hooks:
|
|
|
|
|
- id: cargo-fmt
|
|
|
|
|
name: cargo fmt
|
|
|
|
|
entry: cargo fmt
|
|
|
|
|
language: system
|
|
|
|
|
types: [rust]
|
|
|
|
|
pass_filenames: false
|
|
|
|
|
args: ['--all', '--', '--check']
|
|
|
|
|
|
|
|
|
|
# Rust linting
|
|
|
|
|
- repo: local
|
|
|
|
|
hooks:
|
|
|
|
|
- id: cargo-clippy
|
|
|
|
|
name: cargo clippy
|
|
|
|
|
entry: cargo clippy
|
|
|
|
|
language: system
|
|
|
|
|
types: [rust]
|
|
|
|
|
pass_filenames: false
|
|
|
|
|
args: ['--all-targets', '--all-features', '--', '-D', 'warnings']
|
|
|
|
|
|
|
|
|
|
# Shell script linting
|
|
|
|
|
- repo: https://github.com/shellcheck-py/shellcheck-py
|
|
|
|
|
rev: v0.10.0.1
|
|
|
|
|
hooks:
|
|
|
|
|
- id: shellcheck
|
|
|
|
|
|
|
|
|
|
# Markdown syntax linting (docs/ only)
|
|
|
|
|
- repo: https://github.com/DavidAnson/markdownlint-cli2
|
|
|
|
|
rev: v0.16.0
|
|
|
|
|
hooks:
|
|
|
|
|
- id: markdownlint-cli2
|
|
|
|
|
name: markdownlint (syntax)
|
|
|
|
|
files: '^docs/.*\.md$'
|
|
|
|
|
args: ['--config', '.markdownlint-cli2.jsonc']
|
|
|
|
|
|
|
|
|
|
# Markdown prose linting with Vale (docs/ only)
|
|
|
|
|
- repo: local
|
|
|
|
|
hooks:
|
|
|
|
|
- id: vale
|
|
|
|
|
name: vale (prose quality)
|
|
|
|
|
entry: bash -c 'vale docs/ || exit 0'
|
|
|
|
|
language: system
|
|
|
|
|
files: '^docs/.*\.md$'
|
|
|
|
|
pass_filenames: false
|
|
|
|
|
|
|
|
|
|
# Nickel type checking
|
|
|
|
|
- repo: local
|
|
|
|
|
hooks:
|
|
|
|
|
- id: nickel-typecheck
|
|
|
|
|
name: nickel typecheck
|
|
|
|
|
entry: bash -c 'for f in "$@"; do nickel typecheck "$f" || exit 1; done' --
|
|
|
|
|
language: system
|
|
|
|
|
files: '\.ncl$'
|
2025-12-25 22:59:45 +00:00
|
|
|
exclude: '(nickel-secrets|sops-example|conditional|complex)\.ncl$'
|
2025-12-24 03:26:41 +00:00
|
|
|
|
|
|
|
|
# Nushell script validation
|
|
|
|
|
- repo: local
|
|
|
|
|
hooks:
|
|
|
|
|
- id: nushell-check
|
|
|
|
|
name: nushell check
|
2025-12-25 22:59:45 +00:00
|
|
|
entry: bash -c 'for f in "$@"; do nu --ide-check "$f" || exit 1; done' --
|
2025-12-24 03:26:41 +00:00
|
|
|
language: system
|
|
|
|
|
files: '\.nu$'
|
2025-12-25 22:59:45 +00:00
|
|
|
exclude: '(json-to-nickel)\.nu$'
|
2025-12-24 03:26:41 +00:00
|
|
|
|
|
|
|
|
# Security checks
|
|
|
|
|
- repo: local
|
|
|
|
|
hooks:
|
|
|
|
|
- id: cargo-audit
|
|
|
|
|
name: cargo audit
|
|
|
|
|
entry: cargo audit
|
|
|
|
|
language: system
|
|
|
|
|
pass_filenames: false
|
|
|
|
|
stages: [manual]
|