Skip to content

Commit 13497bc

Browse files
committed
chore: standardize pre-commit hooks
1 parent 2ed7e9e commit 13497bc

2 files changed

Lines changed: 62 additions & 24 deletions

File tree

.pre-commit-config.yaml

Lines changed: 52 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,59 @@ repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
33
rev: v6.0.0
44
hooks:
5-
- id: trailing-whitespace
6-
- id: end-of-file-fixer
75
- id: check-yaml
8-
- id: check-added-large-files
6+
- id: check-json
7+
files: \.json$
98
- id: check-merge-conflict
9+
- id: end-of-file-fixer
10+
- id: trailing-whitespace
11+
- id: no-commit-to-branch
12+
args: ['--branch', 'master']
13+
- id: check-added-large-files
1014
- id: debug-statements
1115
- id: check-executables-have-shebangs
1216

17+
- repo: https://github.com/rhysd/actionlint
18+
rev: v1.7.7
19+
hooks:
20+
- id: actionlint
21+
22+
- repo: https://github.com/Yelp/detect-secrets
23+
rev: v1.5.0
24+
hooks:
25+
- id: detect-secrets
26+
args: ['--baseline', '.secrets.baseline']
27+
exclude: |
28+
(?x)^(
29+
config_template\.json|
30+
\.secrets\.baseline|
31+
systemd/.*|
32+
README\.md|
33+
CLAUDE\.md
34+
)$
35+
36+
- repo: https://github.com/shellcheck-py/shellcheck-py
37+
rev: v0.10.0.1
38+
hooks:
39+
- id: shellcheck
40+
types: [shell]
41+
42+
- repo: local
43+
hooks:
44+
- id: shfmt
45+
name: shfmt
46+
entry: shfmt
47+
language: system
48+
args: [--diff, --indent, '2', --case-indent, --binary-next-line]
49+
types: [shell]
50+
- id: reddit-config-check
51+
name: Check Reddit config safety
52+
# yamllint disable-line rule:line-length
53+
entry: python -c "import json,os;c=json.load(open('config.json')) if os.path.exists('config.json') else {};exit(1) if not c.get('anonymize_moderators',True) else exit(0)"
54+
language: system
55+
files: config\.json$
56+
pass_filenames: false
57+
1358
- repo: https://github.com/psf/black-pre-commit-mirror
1459
rev: 26.1.0
1560
hooks:
@@ -29,32 +74,15 @@ repos:
2974
- id: isort
3075
args: [--profile=black]
3176

32-
- repo: https://github.com/Yelp/detect-secrets
33-
rev: v1.5.0
34-
hooks:
35-
- id: detect-secrets
36-
args: ['--baseline', '.secrets.baseline']
37-
exclude: |
38-
(?x)^(
39-
config_template\.json|
40-
\.secrets\.baseline|
41-
systemd/.*|
42-
README\.md|
43-
CLAUDE\.md
44-
)$
45-
4677
- repo: https://github.com/pre-commit/mirrors-mypy
4778
rev: v1.19.1
4879
hooks:
4980
- id: mypy
5081
additional_dependencies: [types-requests]
5182
args: [--ignore-missing-imports]
5283

53-
- repo: local
84+
- repo: https://github.com/adrienverge/yamllint
85+
rev: v1.35.1
5486
hooks:
55-
- id: reddit-config-check
56-
name: Check Reddit config safety
57-
entry: python -c "import json; config = json.load(open('config.json')) if __import__('os').path.exists('config.json') else {}; exit(1) if not config.get('anonymize_moderators', True) else exit(0)"
58-
language: system
59-
files: config\.json$
60-
pass_filenames: false
87+
- id: yamllint
88+
args: [--config-file, .yamllint.yml]

.yamllint.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
extends: default
2+
3+
rules:
4+
line-length:
5+
max: 200
6+
truthy:
7+
check-keys: false
8+
comments:
9+
min-spaces-from-content: 1
10+
document-start: disable

0 commit comments

Comments
 (0)