-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlefthook.yml
More file actions
43 lines (39 loc) · 1.68 KB
/
Copy pathlefthook.yml
File metadata and controls
43 lines (39 loc) · 1.68 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
pre-commit:
commands:
comment-language:
run: commit-checker diff
golangci-lint:
glob: "*.go"
run: golangci-lint run --fix
stage_fixed: true
gosec:
glob: "*.go"
run: gosec -exclude=G304,G204,G306 -exclude-dir=internal/comment/testdata ./...
testdata-golden:
# testdata 파일에 대해 파서·언어 검사 결과를 골든 파일과 비교하여 동작 변경을 감지합니다.
# 골든 파일 업데이트: go test ./internal/checker/... -run TestCommentCheckerGolden -update
glob: "{internal/comment/testdata/**,internal/checker/testdata/**,internal/comment/**_parser.go,internal/langdetect/**}"
run: go test ./internal/comment/... ./internal/checker/... -run "TestCommentCheckerGolden|TestGetParser"
# merge 커밋은 pre-commit 훅을 타지 않으므로, feature 브랜치의 위반이
# merge 로 main 에 들어오는 것을 막기 위해 pre-merge-commit 에도 등록합니다.
pre-merge-commit:
commands:
comment-language:
run: commit-checker diff
# 커밋 메시지 에디터에 활성 정책 힌트를 # 주석으로 표시 (-m/merge/squash/amend 시 무동작)
# {0} 사용 필수 — {1} {2} {3} 은 인자가 없을 때 리터럴로 남아 깨짐 (lefthook 2.1.9 실측)
prepare-commit-msg:
commands:
policy-hint:
run: commit-checker prepare-msg {0}
commit-msg:
commands:
message-policy:
# {1} 은 lefthook 이 커밋 메시지 파일 경로로 치환
run: commit-checker msg {1}
# pre-push 훅 예시: 푸쉬 전 커밋 메시지 정책 검사
# 활성화하려면 아래 주석을 해제하세요
# pre-push:
# commands:
# check-commits:
# run: commit-checker push