Repository navigation
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
79 lines (73 loc) · 2.44 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
79 lines (73 loc) · 2.44 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
# Pre-commit hooks configuration
# Install: pip install pre-commit && pre-commit install
# Run manually: pre-commit run --all-files
repos:
# Large file detection
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-added-large-files
args: ['--maxkb=500']
description: Prevent giant files from being committed
- id: check-file-size
args: ['--maxkb=500']
description: Check for files over 500KB
- id: trailing-whitespace
description: Trim trailing whitespace
- id: end-of-file-fixer
description: Fix end of file issues
- id: check-yaml
description: Check YAML files for syntax errors
- id: check-json
description: Check JSON files for syntax errors
- id: check-merge-conflict
description: Check for merge conflict markers
- id: check-case-conflict
description: Check for case conflicts in filenames
- id: detect-private-key
description: Detect private keys in files
- id: forbid-submodules
description: Forbid git submodules
# Go-specific checks
- repo: https://github.com/dnephin/pre-commit-golang
rev: v0.5.1
hooks:
- id: go-fmt
description: Run gofmt on Go files
- id: go-imports
description: Run goimports on Go files
- id: go-mod-tidy
description: Run go mod tidy
- id: go-unit-tests
description: Run Go unit tests
pass_filenames: false
# Lint with golangci-lint (mirrors CI lint gate; uses .golangci.yml)
- repo: local
hooks:
- id: golangci-lint
name: golangci-lint
description: Run golangci-lint to match CI before commit
entry: golangci-lint run --timeout 5m
language: system
types: [go]
pass_filenames: false
# Secret scanning
- repo: https://github.com/gitleaks/gitleaks
rev: v8.21.2
hooks:
- id: gitleaks
name: Detect secrets in code
description: Detect secrets with gitleaks
entry: gitleaks detect --config-path=.gitleaks.toml --redact -v
language_version: default
# CI configuration
ci:
autofix_commit_msg: |
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
autofix_prs: true
autoupdate_branch: ''
autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate'
autoupdate_schedule: weekly
skip: []
submodules: false