-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
105 lines (95 loc) · 3.04 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
105 lines (95 loc) · 3.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
---
# Pre-commit configuration for Artefiles
# Hooks for linting, formatting, and validation of configuration files
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-toml
- id: check-json
- id: check-added-large-files
- id: check-merge-conflict
- id: check-executables-have-shebangs
- id: detect-private-key
- id: mixed-line-ending
args: [--fix=lf]
# Shell script formatting
- repo: https://github.com/jumanjihouse/pre-commit-hooks
rev: 3.0.0
hooks:
- id: shfmt
args: [-i, '2', -ci, -bn, -sr]
# Check for spelling mistakes
- repo: https://github.com/codespell-project/codespell
rev: v2.4.1
hooks:
- id: codespell
args: ["--ignore-words=.codespellignore"]
exclude: ".git/"
# Validate YAML files
- repo: https://github.com/adrienverge/yamllint
rev: v1.37.1
hooks:
- id: yamllint
args: ["-d", "relaxed"]
# Format and validate TOML files
- repo: https://github.com/pappasam/toml-sort
rev: v0.24.2
hooks:
- id: toml-sort-fix
# Check for secrets
- repo: https://github.com/gitleaks/gitleaks
rev: v8.28.0
hooks:
- id: gitleaks
# Conventional commit messages
- repo: https://github.com/compilerla/conventional-pre-commit
rev: v4.2.0
hooks:
- id: conventional-pre-commit
stages: [commit-msg]
args: [feat, fix, docs, style, refactor, test, chore, ci] # Expanded allowed types
# Custom local hooks
- repo: local
hooks:
- id: validate-changelog
name: Validate that changelog is up-to-date
description: Validates that CHANGELOG.md is up-to-date before pushing.
language: system
pass_filenames: false
stages: [pre-push]
entry: |
bash -c '
# --- Get the range of commits being pushed ---
read local_ref local_sha remote_ref remote_sha
# If branch is being deleted, exit successfully.
if [ "$local_sha" = "0000000000000000000000000000000000000000" ]; then
exit 0
fi
# Check if git-cliff is installed.
if ! command -v git-cliff >/dev/null 2>&1; then
echo "git-cliff not installed. Skipping changelog validation."
exit 0
fi
# --- Check if running git-cliff changes CHANGELOG.md ---
git-cliff
if ! git diff --quiet CHANGELOG.md; then
echo "CHANGELOG.md has been updated. Please add and commit the changes:" >&2
echo " git add CHANGELOG.md" >&2
echo " git commit -m \"chore(changelog): Update changelog\"" >&2
exit 1
fi
exit 0
'
# pre-commit.ci configuration
ci:
autofix_commit_msg: 'style: pre-commit.ci auto fixes'
autofix_prs: true
autoupdate_branch: ''
autoupdate_commit_msg: 'chore: pre-commit.ci autoupdate'
autoupdate_schedule: weekly
skip: []
submodules: false