-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
129 lines (121 loc) · 3.42 KB
/
.pre-commit-config.yaml
File metadata and controls
129 lines (121 loc) · 3.42 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
repos:
# Basic 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
- id: check-yaml
- id: check-toml
- id: check-json
exclude: 'layouts/.*\.json'
- id: check-merge-conflict
- id: check-added-large-files
args: ["--maxkb=1000"]
- id: detect-private-key
- id: check-case-conflict
- id: mixed-line-ending
# JavaScript/CSS formatting and linting
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
hooks:
- id: prettier
files: \.(js|ts|css|scss|json|md|yaml|yml)$
exclude: |
(?x)^(
hugo_stats\.json|
package-lock\.json|
layouts/.*\.json|
themes/.*|
public/.*|
resources/.*
)$
# Markdown linting
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.41.0
hooks:
- id: markdownlint
args: ["--fix"]
exclude: |
(?x)^(
themes/.*|
public/.*|
README\.md
)$
# YAML linting
- repo: https://github.com/adrienverge/yamllint
rev: v1.35.1
hooks:
- id: yamllint
args: [-c=.yamllint]
# Security scanning
- repo: https://github.com/Yelp/detect-secrets
rev: v1.5.0
hooks:
- id: detect-secrets
exclude: |
(?x)^(
package-lock\.json|
\.git/.*|
themes/.*
)$
# Hugo specific checks
- repo: local
hooks:
- id: hugo-build-check
name: Hugo Build Check
entry: hugo
args: ["--buildDrafts", "--buildFuture", "--quiet"]
language: system
pass_filenames: false
files: \.(md|toml|yaml|yml|html|js|css)$
exclude: |
(?x)^(
themes/.*|
public/.*|
resources/.*
)$
# - id: tailwind-check
# name: Tailwind CSS Check
# entry: bash
# args:
# - -c
# - |
# if command -v npx >/dev/null 2>&1; then
# npx tailwindcss --input ./assets/main.css --output ./static/css/styles.css --dry-run >/dev/null 2>&1
# fi
# language: system
# files: \.(css|html|md|js)$
# exclude: |
# (?x)^(
# themes/.*|
# public/.*|
# resources/.*|
# static/css/styles\.css
# )$
- id: no-todo-fixme
name: Check for TODO/FIXME comments
entry: bash
args:
- -c
- |
if grep -rn --include="*.md" --include="*.html" --include="*.js" --include="*.css" --exclude-dir="themes" --exclude-dir="public" --exclude-dir="resources" --exclude-dir="node_modules" -E "(#|//|/\*|\*)?\s*(TODO|FIXME|HACK)\b" content/ layouts/ assets/ static/ *.md *.js *.css 2>/dev/null; then
echo "Found TODO/FIXME comments in source files. Please resolve them before committing."
exit 1
fi
language: system
pass_filenames: false
# Spelling check for content
- repo: https://github.com/crate-ci/typos
rev: v1.24.6
hooks:
- id: typos
exclude: |
(?x)^(
themes/.*|
public/.*|
resources/.*|
package-lock\.json|
\.git/.*
)$