Skip to content

Commit 0aff9fb

Browse files
committed
chore: enhance pre-commit hooks for improved code quality
Add several pre-commit checks to strengthen code quality and security: - Limit large file commits to 500KB - Detect case conflicts, merge conflicts and broken symlinks - Validate YAML files and detect private keys - Standardize line endings to LF - Ensure executables have shebangs The existing trailing whitespace check remains unchanged.
1 parent 290dcea commit 0aff9fb

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

.pre-commit-config.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,24 @@ repos:
77
description: Removes trailing whitespace from files
88
types: [text, rust] # Runs on text files and Rust files specifically
99
exclude: '\.(ico|jpg|png|gif|eot|svg|ttf|woff|woff2)$' # Skip binary files
10+
- id: check-added-large-files
11+
args: [ '--maxkb=500' ]
12+
description: Prevents giant files from being committed
13+
- id: check-case-conflict
14+
description: Checks for files with names that would conflict on case-insensitive filesystems
15+
- id: check-merge-conflict
16+
description: Checks for files containing merge conflict strings
17+
- id: check-symlinks
18+
description: Checks for symlinks pointing nowhere
19+
- id: detect-private-key
20+
description: Detects presence of private keys
21+
- id: check-yaml
22+
description: Validates YAML files
23+
- id: mixed-line-ending
24+
args: [ --fix=lf ]
25+
description: Replaces mixed line endings with LF
26+
- id: check-executables-have-shebangs
27+
description: Ensures executable files have shebangs
1028

1129
- repo: local
1230
hooks:

0 commit comments

Comments
 (0)