-
Notifications
You must be signed in to change notification settings - Fork 1
/
.pre-commit-config.yaml
168 lines (146 loc) · 5.56 KB
/
.pre-commit-config.yaml
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
- id: check-added-large-files
name: Large Files check
args: ['--maxkb=1024']
- id: check-merge-conflict
name: Merge Conflict Resolution Check
- id: end-of-file-fixer
name: Newline EOF Checker
- id: fix-byte-order-marker
name: Fix UTF-8 byte order marker
- id: trailing-whitespace
name: Whitespace Cleaning Check
args: [--markdown-linebreak-ext=md]
- repo: https://github.com/gitleaks/gitleaks
rev: v8.18.0
hooks:
- id: gitleaks
name: GitLeaks Checks
- repo: https://github.com/sirosen/fix-smartquotes
rev: 0.2.0
hooks:
- id: fix-smartquotes
- repo: https://github.com/DavidAnson/markdownlint-cli2
rev: v0.12.1
hooks:
- id: markdownlint-cli2
name: Markdown Linting
- repo: https://github.com/dnephin/pre-commit-golang
rev: v0.4.0
hooks:
- id: go-fmt
name: Golang Formatting
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.1
hooks:
- id: ruff
name: Ruff Linting
args: [--fix]
types_or: [python, pyi, jupyter]
pass_filenames: false
- id: ruff-format
name: Ruff Formatting
types_or: [python, pyi, jupyter]
pass_filenames: false
- repo: https://github.com/pre-commit/mirrors-eslint
rev: v8.56.0
hooks:
- id: eslint
name: ESLint and Prettier
files: \.([jt]sx?|svelte)$ # *.js, *.jsx, *.ts, *.tsx and *.svelte
types: [file]
additional_dependencies:
args: [--fix]
- repo: https://github.com/hadolint/hadolint
rev: v2.12.0
hooks:
- id: hadolint-docker
name: Dockerfile Lint
- repo: https://github.com/gruntwork-io/pre-commit
rev: v0.1.23
hooks:
- id: helmlint
name: Helm Chart Linting
# get latest zarf schema
- repo: local
hooks:
- id: download-schema
name: 'Download Zarf Schema'
entry: bash -c 'curl -o zarf.schema.json https://raw.githubusercontent.com/defenseunicorns/zarf/main/zarf.schema.json'
language: system
# check against latest zarf schema
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.14.0
hooks:
- id: check-jsonschema
name: 'Validate Zarf Configs Against Schema'
files: 'zarf.yaml'
types: [yaml]
args: ['--schemafile', 'zarf.schema.json']
# clean-up latest zarf schema
- repo: local
hooks:
- id: delete-schema
name: 'Delete Zarf Schema'
entry: bash -c 'rm -f zarf.schema.json'
language: system
# get latest uds schema
- repo: local
hooks:
- id: download-schema
name: 'Download UDS Schema'
entry: bash -c 'curl -o uds.schema.json https://raw.githubusercontent.com/defenseunicorns/uds-cli/main/uds.schema.json'
language: system
# check against latest uds schema
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.14.0
hooks:
- id: check-jsonschema
name: 'Validate UDS Configs Against Schema'
files: 'uds-bundle.yaml'
types: [yaml]
args: ['--schemafile', 'uds.schema.json']
# clean-up latest uds schema
- repo: local
hooks:
- id: delete-schema
name: 'Delete UDS Schema'
entry: bash -c 'rm -f uds.schema.json'
language: system
# naive approaches for checking dependencies versus project definitions
# creates warning messages if changes are detected in any of the dependency files
- repo: local
hooks:
- id: check-paired-files-python
name: Check PyProject
entry: bash -c '
if git diff --cached --name-only | grep -q -E "^(pyproject\.toml)$"; then
git diff --cached --name-only | grep -q -E "^(requirements(-[^.]+)?\.txt)$" || echo "Warning, you may need to check your Python dependencies";
fi;
if git diff --cached --name-only | grep -q -E "^(requirements(-[^.]+)?\.txt)$"; then
git diff --cached --name-only | grep -q -E "^(pyproject\.toml)$" || echo "Warning, you may need to check your Python dependencies";
fi'
language: system
always_run: true
pass_filenames: false
- repo: local
hooks:
- id: check-paired-files-node
name: Check NPM Packages
entry: bash -c '
if git diff --cached --name-only | grep -q -E "^(package\.json)$"; then
git diff --cached --name-only | grep -q -E "^(package-lock\.json)$" || echo "Warning, you may need to check your NPM dependencies";
fi;
if git diff --cached --name-only | grep -q -E "^(package-lock\.json)$"; then
git diff --cached --name-only | grep -q -E "^(package\.json)$" || echo "Warning, you may need to check your NPM dependencies";
fi
' --
language: system
always_run: true
pass_filenames: false