Repository navigation
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
124 lines (107 loc) · 3.52 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
124 lines (107 loc) · 3.52 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
default_language_version:
python: python3
default_stages: [pre-commit]
fail_fast: false
repos:
# ==========================================
# 1. 기본 파일 검사
# ==========================================
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
# 파일 끝 줄바뀜
- id: end-of-file-fixer
name: "파일 끝 개행 확인"
# 줄 끝 공백 제거
- id: trailing-whitespace
name: "줄 끝 공백 제거"
args: [--markdown-linebreak-ext=md]
# YAML 문법 검사
- id: check-yaml
name: "YAML 문법 검사"
args: [--allow-multiple-documents]
# TOML 문법 검사
- id: check-toml
name: "TOML 문법 검사"
# JSON 문법 검사
- id: check-json
name: "JSON 문법 검사"
# Merge 충돌 마커 확인
- id: check-merge-conflict
name: "Merge 충돌 확인"
# 디버그 구문 확인
- id: debug-statements
name: "디버그 구문 확인"
# Private 키 탐지
- id: detect-private-key
name: "Private 키 탐지"
# AWS 자격증명 탐지
- id: detect-aws-credentials
name: "AWS 자격증명 탐지"
args: [--allow-missing-credentials]
# 대용량 파일 차단 (1MB)
- id: check-added-large-files
name: "대용량 파일 차단"
args: [--maxkb=1024]
# ==========================================
# 2. Ruff Linter
# ==========================================
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.16.10
hooks:
- id: ruff
name: "Ruff 린터"
args:
- --fix
- --exit-non-zero-on-fix
# ==========================================
# 3. Ruff Formatter
# ==========================================
- id: ruff-format
name: "Ruff 포매터"
# ==========================================
# 4. 자동 수정 검토 안내
# index를 변경하지 않아 부분 staging을 보존한다.
# (반드시 ruff/ruff-format 다음에 위치)
# ==========================================
- repo: local
hooks:
- id: review-fixes
name: "자동 수정 검토 안내"
entry: python3 scripts/stage_fixes.py
language: system
stages: [pre-commit]
pass_filenames: true
require_serial: true
# ==========================================
# 5. Commitizen (commit-msg 단계)
# ==========================================
- repo: https://github.com/commitizen-tools/commitizen
rev: v4.19.1
hooks:
- id: commitizen
name: "Commitizen 메시지 검증"
stages: [commit-msg]
# ==========================================
# 6. Pre-push 게이트 (테스트 + 타입체크)
# 빠른 모드 — 30s 이내로 --no-verify 우회 유혹 차단.
# 80% 커버리지 게이트는 CI에서만 적용.
# 프로젝트 venv 경로를 명시 (Makefile과 일관).
# ==========================================
- repo: local
hooks:
- id: pytest-push
name: "pytest (push 전, 빠른 모드)"
entry: .venv/bin/python -m pytest -x --no-cov -q
language: system
stages: [pre-push]
pass_filenames: false
always_run: true
- id: mypy-push
name: "mypy (push 전)"
entry: .venv/bin/python -m mypy src scripts
language: system
types: [python]
stages: [pre-push]
pass_filenames: false
always_run: true