Repository navigation
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
95 lines (88 loc) · 2.79 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
95 lines (88 loc) · 2.79 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
# Pre-commit hooks for WeOwn AI Infrastructure
# Install: pip install pre-commit && pre-commit install
# Run manually: pre-commit run --all-files
# https://pre-commit.com/
repos:
# Gitleaks - Secret detection (scans only staged changes by default in pre-commit)
- repo: https://github.com/gitleaks/gitleaks
rev: v8.18.4
hooks:
- id: gitleaks
args: ["--config", ".gitleaks.toml"]
# YAML linting
- repo: https://github.com/adrienverge/yamllint
rev: v1.35.1
hooks:
- id: yamllint
args: ["-c", ".yamllint.yml"]
exclude: |
(?x)^(
.*\.jinja$|
wordpress-docker/template/.*|
.*/templates/.*\.yaml$
)$
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.10.0.1
hooks:
- id: shellcheck
args: ["--severity=error"]
exclude: |
(?x)^(
.*\.jinja$
)$
# site.conf secret lint — catches accidental secret commits in site.conf files
- repo: local
hooks:
- id: lint-site-conf
name: Lint site.conf (no secrets)
entry: scripts/lint-site-conf.sh
language: system
files: 'site\.conf$'
pass_filenames: true
# Helm chart linting
- repo: local
hooks:
- id: helm-lint
name: Helm Lint
entry: bash -c 'command -v helm >/dev/null 2>&1 || exit 0; for chart in */helm/Chart.yaml; do dir=$(dirname "$chart"); helm lint "$dir" || exit 1; done'
language: system
files: '.*/helm/.*\.(yaml|yml)$'
pass_filenames: false
# Terraform/OpenTofu validation (skip gracefully when binary not installed)
- repo: local
hooks:
- id: terraform_fmt
name: Terraform fmt
entry: bash -c 'command -v terraform >/dev/null 2>&1 || command -v tofu >/dev/null 2>&1 || exit 0; TF=$(command -v tofu || command -v terraform); for f in $(git ls-files "*.tf"); do "$TF" fmt "$f"; done'
language: system
files: '\.tf$'
pass_filenames: false
# General file checks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: trailing-whitespace
exclude: '\.md$'
- id: end-of-file-fixer
exclude: |
(?x)^(
.*\.jinja$
)$
- id: check-yaml
args: ["--allow-multiple-documents"]
exclude: |
(?x)^(
.*\.jinja$|
wordpress-docker/template/.*|
.*/templates/.*\.yaml$
)$
- id: check-added-large-files
args: ["--maxkb=1000"]
- id: check-merge-conflict
- id: detect-private-key
# Markdown linting
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.41.0
hooks:
- id: markdownlint
args: ["--fix", "--disable", "MD013", "MD033", "MD041", "--"]