|
1 | 1 | # ---------------------------------------------------------------------- |
2 | | -# Pre‑commit Configuration for go-safe-conversion |
| 2 | +# Pre‑commit Configuration for the local repository |
3 | 3 | # |
4 | 4 | # Purpose: Enforce code quality, security, and COMMENTING RULES defined |
5 | 5 | # in .github/AGENTS.md before any commit reaches the repository. |
|
15 | 15 | minimum_pre_commit_version: "3.7.0" # requires Python‑based hooks v2.0+ |
16 | 16 |
|
17 | 17 | repos: |
18 | | - # ---------------------- Core hygiene hooks -------------------------- |
19 | | - - repo: https://github.com/pre-commit/pre-commit-hooks |
20 | | - rev: v4.6.0 |
21 | | - hooks: |
22 | | - - id: check-added-large-files |
23 | | - - id: end-of-file-fixer |
24 | | - - id: trailing-whitespace |
25 | | - - id: check-merge-conflict |
| 18 | + # ---------------------- Core hygiene hooks -------------------------- |
| 19 | + - repo: https://github.com/pre-commit/pre-commit-hooks |
| 20 | + rev: cef0300fd0fc4d2a87a85fa2093c6b283ea36f4b # frozen: v5.0.0 |
| 21 | + hooks: |
| 22 | + - id: check-added-large-files |
| 23 | + - id: end-of-file-fixer |
| 24 | + - id: trailing-whitespace |
| 25 | + - id: check-merge-conflict |
26 | 26 |
|
27 | | - # ------------------------- Go toolchain ----------------------------- |
28 | | - - repo: https://github.com/dnephin/pre-commit-golang |
29 | | - rev: v1.5.2 |
30 | | - hooks: |
31 | | - - id: go-fmt |
32 | | - - id: go-imports |
33 | | - - id: go-vet |
34 | | - - id: golangci-lint |
35 | | - args: [ "--config=.golangci.json --verbose" ] |
| 27 | + # ------------------------- Go toolchain ----------------------------- |
| 28 | + - repo: https://github.com/TekWizely/pre-commit-golang |
| 29 | + rev: 302c7fd28cdbb62d5fd1e3965fe36e33a5f77803 # frozen: v1.0.0-rc.1 |
| 30 | + hooks: |
| 31 | + - id: go-fmt |
| 32 | + - id: go-vet |
| 33 | + - id: go-lint |
| 34 | + - id: go-imports |
| 35 | + - id: golangci-lint |
| 36 | + - id: go-mod-tidy |
36 | 37 |
|
37 | | - # ------------------------ Security scans --------------------------- |
38 | | - - repo: https://github.com/zricethezav/gitleaks |
39 | | - rev: v8.18.2 |
40 | | - hooks: |
41 | | - - id: gitleaks |
42 | | - stages: [ commit, push ] |
| 38 | + # ------------------------ Security scans --------------------------- |
| 39 | + - repo: https://github.com/zricethezav/gitleaks |
| 40 | + rev: 47218a628da59ef6b24197d15f4b0248ca87f4f0 # frozen: v8.27.2 |
| 41 | + hooks: |
| 42 | + - id: gitleaks |
| 43 | + stages: [ pre-commit, pre-push ] |
43 | 44 |
|
44 | | - # ------------------- Commenting rule enforcement ------------------- |
45 | | - - repo: local |
46 | | - hooks: |
47 | | - - id: revive-comment-style |
48 | | - name: "revive: enforce GoDoc & comment style from AGENTS.md" |
49 | | - language: system |
50 | | - entry: | |
51 | | - bash -c 'revive -config .revive.toml ./...' |
52 | | - types: [ go ] |
53 | | - fail_fast: true |
| 45 | + # ------------------- Commenting rule enforcement ------------------- |
| 46 | + - repo: local |
| 47 | + hooks: |
| 48 | + - id: revive-comment-style |
| 49 | + name: "revive: enforce GoDoc & comment style from AGENTS.md" |
| 50 | + language: system |
| 51 | + entry: | |
| 52 | + bash -c 'revive -config .revive.toml ./...' |
| 53 | + types: [ go ] |
| 54 | + fail_fast: true |
54 | 55 |
|
55 | | - - id: comment-conventions |
56 | | - name: "custom comment linter (AGENTS.md)" |
57 | | - language: python |
58 | | - entry: scripts/comment_lint.py |
59 | | - types: [ go, markdown ] |
60 | | - pass_filenames: true |
61 | | - additional_dependencies: |
62 | | - - regex==2025.6 |
63 | | - - ruamel.yaml==0.18 |
| 56 | + - id: comment-conventions |
| 57 | + name: "custom comment linter (AGENTS.md)" |
| 58 | + language: python |
| 59 | + entry: scripts/comment_lint.py |
| 60 | + types: [ go, markdown ] |
| 61 | + pass_filenames: true |
| 62 | + additional_dependencies: |
| 63 | + - regex==2025.6 |
| 64 | + - ruamel.yaml==0.18 |
64 | 65 |
|
65 | | - # --------------------- Commit‑msg validation ----------------------- |
66 | | - - repo: https://github.com/antham/commitlint |
67 | | - rev: v0.7.0 |
68 | | - hooks: |
69 | | - - id: commitlint |
70 | | - stages: [ commit-msg ] |
71 | | - entry: commitlint -g .github/commitlint.config.js |
72 | | - additional_dependencies: |
73 | | - - "@commitlint/config-conventional@19.3.0" |
74 | | - - "@commitlint/cli@19.3.0" |
| 66 | + # --------------------- Commit‑msg validation ----------------------- |
| 67 | + - repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook |
| 68 | + rev: 879f5400493f84c8b683bdeb3366a8439ca17858 # frozen: v9.22.0 |
| 69 | + hooks: |
| 70 | + - id: commitlint |
| 71 | + stages: [ commit-msg ] |
| 72 | + additional_dependencies: [ '@commitlint/config-conventional' ] |
75 | 73 |
|
76 | | -default_stages: [commit, push] |
| 74 | +default_stages: [ pre-commit, pre-push ] |
0 commit comments