63 lines
1.7 KiB
YAML
63 lines
1.7 KiB
YAML
default_install_hook_types:
|
|
- pre-commit
|
|
- commit-msg
|
|
|
|
repos:
|
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
rev: v0.14.4
|
|
hooks:
|
|
- id: ruff-check
|
|
name: Ruff (lint + fix)
|
|
args: [--config=pyproject.toml, --fix]
|
|
types_or: [python, pyi]
|
|
- id: ruff-format
|
|
name: Ruff (format)
|
|
args: [--config=pyproject.toml]
|
|
types_or: [python, pyi]
|
|
|
|
|
|
- repo: https://github.com/pre-commit/mirrors-clang-format
|
|
rev: v18.1.8
|
|
hooks:
|
|
- id: clang-format
|
|
name: clang-format (C++)
|
|
args: [--style=file, --fallback-style=none]
|
|
types_or: [c++, c]
|
|
exclude: ^thirdparty/.*$
|
|
|
|
|
|
- repo: https://github.com/gitleaks/gitleaks
|
|
rev: v8.21.4
|
|
hooks:
|
|
- id: gitleaks
|
|
name: Detect hardcoded secrets (gitleaks)
|
|
description: Scans staged files for secrets using gitleaks rules
|
|
|
|
|
|
- repo: https://github.com/compilerla/conventional-pre-commit
|
|
rev: v4.3.0
|
|
hooks:
|
|
- id: conventional-pre-commit
|
|
stages: [commit-msg]
|
|
args: [--verbose]
|
|
|
|
|
|
- repo: local
|
|
hooks:
|
|
- id: branch-name-check
|
|
name: Check branch name format
|
|
entry: >-
|
|
bash -c '
|
|
branch=$(git symbolic-ref --short HEAD);
|
|
pattern="^(feat|fix|docs|refactor|test|chore)/[a-z0-9-]+$";
|
|
if [[ $branch =~ $pattern ]]; then
|
|
exit 0;
|
|
else
|
|
echo "Invalid branch name: $branch";
|
|
echo "Must match: <type>/<lower-case-hyphen-separated>";
|
|
echo "Examples: feat/user-api, fix/header-bug, chore/update-deps";
|
|
exit 1;
|
|
fi
|
|
'
|
|
language: system
|
|
stages: [ pre-push ] |