-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
59 lines (52 loc) · 1.76 KB
/
.pre-commit-config.yaml
File metadata and controls
59 lines (52 loc) · 1.76 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
# .pre-commit-config.yaml
# Configuration for pre-commit hooks
# Install with: pip install pre-commit && pre-commit install
repos:
# Built-in pre-commit hooks for basic checks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: trailing-whitespace
exclude: \.md$ # Allow trailing spaces in markdown for line breaks
- id: end-of-file-fixer
- id: check-yaml
- id: check-json
- id: check-toml
- id: check-merge-conflict
- id: check-added-large-files
args: ["--maxkb=1000"] # Prevent files larger than 1MB
- repo: local
hooks:
- id: todo-warning
name: TODO Comment Warning
entry: bash
args:
[
-c,
'files=$(git diff --cached --name-only --diff-filter=AM | grep -E "\.(py|js|ts|java|cpp|c|h|go|rs)$"); if [ -n "$files" ]; then echo "$files" | xargs grep -Hn "TODO" || echo "✅ No TODOs found"; else echo "✅ No code files staged"; fi',
]
language: system
always_run: false
verbose: true
# Run black via your pyproject.toml config
- id: black-local
name: Black (using pyproject.toml config)
entry: black
args: ["--diff"]
language: system
files: \.py$
require_serial: false
# Run isort via your pyproject.toml config
- id: isort-local
name: isort (using pyproject.toml config)
entry: isort
args: ["--diff"]
language: system
files: \.py$
# Global configuration
default_language_version:
python: python3
# Speed up hooks by only running on changed files
default_stages: [pre-commit]
# Fail fast - stop on first failure
fail_fast: false # Set to true if you want to stop on first error