Skip to content

Commit 0afb3f5

Browse files
authored
chore: add pre-commit hooks and secrets baseline (#1)
## Summary - Adds `.pre-commit-config.yaml` with trailing-whitespace, end-of-file-fixer, large file check, merge conflict check, private key detection, mixed line ending fix (LF), and detect-secrets hooks - Generates clean `.secrets.baseline` (no secrets detected in repo) ## Hooks included | Source | Hooks | |--------|-------| | `pre-commit-hooks` v5.0.0 | trailing-whitespace, end-of-file-fixer, check-added-large-files, check-merge-conflict, detect-private-key, mixed-line-ending | | `detect-secrets` v1.5.0 | detect-secrets (with baseline) | ## Test plan - [ ] Run `pre-commit run --all-files` to verify all hooks pass - [ ] Confirm `.secrets.baseline` has no flagged results <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Release Notes * **Chores** * Added automated pre-commit checks to enforce code quality standards including whitespace consistency, file endings, and line ending normalization * Enabled detection of merge conflicts and private keys during commits * Configured secret detection baseline to prevent accidental sensitive information in repository <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent dc5f7f2 commit 0afb3f5

File tree

2 files changed

+151
-0
lines changed

2 files changed

+151
-0
lines changed

.pre-commit-config.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v6.0.0
4+
hooks:
5+
- id: trailing-whitespace
6+
name: trim trailing whitespace
7+
- id: end-of-file-fixer
8+
name: fix end of files
9+
- id: check-added-large-files
10+
name: check for added large files
11+
- id: check-merge-conflict
12+
name: check for merge conflicts
13+
- id: detect-private-key
14+
name: detect private key
15+
- id: mixed-line-ending
16+
name: mixed line ending
17+
args: ['--fix=lf']
18+
19+
- repo: https://github.com/Yelp/detect-secrets
20+
rev: v1.5.0
21+
hooks:
22+
- id: detect-secrets
23+
name: detect secrets
24+
args: ['--baseline', '.secrets.baseline']

.secrets.baseline

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
{
2+
"version": "1.5.0",
3+
"plugins_used": [
4+
{
5+
"name": "ArtifactoryDetector"
6+
},
7+
{
8+
"name": "AWSKeyDetector"
9+
},
10+
{
11+
"name": "AzureStorageKeyDetector"
12+
},
13+
{
14+
"name": "Base64HighEntropyString",
15+
"limit": 4.5
16+
},
17+
{
18+
"name": "BasicAuthDetector"
19+
},
20+
{
21+
"name": "CloudantDetector"
22+
},
23+
{
24+
"name": "DiscordBotTokenDetector"
25+
},
26+
{
27+
"name": "GitHubTokenDetector"
28+
},
29+
{
30+
"name": "GitLabTokenDetector"
31+
},
32+
{
33+
"name": "HexHighEntropyString",
34+
"limit": 3.0
35+
},
36+
{
37+
"name": "IbmCloudIamDetector"
38+
},
39+
{
40+
"name": "IbmCosHmacDetector"
41+
},
42+
{
43+
"name": "IPPublicDetector"
44+
},
45+
{
46+
"name": "JwtTokenDetector"
47+
},
48+
{
49+
"name": "KeywordDetector",
50+
"keyword_exclude": ""
51+
},
52+
{
53+
"name": "MailchimpDetector"
54+
},
55+
{
56+
"name": "NpmDetector"
57+
},
58+
{
59+
"name": "OpenAIDetector"
60+
},
61+
{
62+
"name": "PrivateKeyDetector"
63+
},
64+
{
65+
"name": "PypiTokenDetector"
66+
},
67+
{
68+
"name": "SendGridDetector"
69+
},
70+
{
71+
"name": "SlackDetector"
72+
},
73+
{
74+
"name": "SoftlayerDetector"
75+
},
76+
{
77+
"name": "SquareOAuthDetector"
78+
},
79+
{
80+
"name": "StripeDetector"
81+
},
82+
{
83+
"name": "TelegramBotTokenDetector"
84+
},
85+
{
86+
"name": "TwilioKeyDetector"
87+
}
88+
],
89+
"filters_used": [
90+
{
91+
"path": "detect_secrets.filters.allowlist.is_line_allowlisted"
92+
},
93+
{
94+
"path": "detect_secrets.filters.common.is_ignored_due_to_verification_policies",
95+
"min_level": 2
96+
},
97+
{
98+
"path": "detect_secrets.filters.heuristic.is_indirect_reference"
99+
},
100+
{
101+
"path": "detect_secrets.filters.heuristic.is_likely_id_string"
102+
},
103+
{
104+
"path": "detect_secrets.filters.heuristic.is_lock_file"
105+
},
106+
{
107+
"path": "detect_secrets.filters.heuristic.is_not_alphanumeric_string"
108+
},
109+
{
110+
"path": "detect_secrets.filters.heuristic.is_potential_uuid"
111+
},
112+
{
113+
"path": "detect_secrets.filters.heuristic.is_prefixed_with_dollar_sign"
114+
},
115+
{
116+
"path": "detect_secrets.filters.heuristic.is_sequential_string"
117+
},
118+
{
119+
"path": "detect_secrets.filters.heuristic.is_swagger_file"
120+
},
121+
{
122+
"path": "detect_secrets.filters.heuristic.is_templated_secret"
123+
}
124+
],
125+
"results": {},
126+
"generated_at": "2026-03-07T02:18:31Z"
127+
}

0 commit comments

Comments
 (0)