Skip to content

Commit 997cacc

Browse files
update pre-conmmit-config.yaml
1 parent e59fcc0 commit 997cacc

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

.pre-commit-config.yaml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.4.0
4+
hooks:
5+
- id: check-yaml
6+
- id: end-of-file-fixer
7+
- id: trailing-whitespace
8+
- repo: https://github.com/PyCQA/isort
9+
rev: 5.12.0
10+
hooks:
11+
- id: isort
12+
args: ["--profile", black]
13+
- repo: local
14+
hooks:
15+
- id: check-todo
16+
name: check TODO keyword
17+
entry: todo.sh
18+
language: script
19+
verbose: true
20+
require_serial: true

todo.sh

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/zsh
2+
3+
files=($(git diff --cached --name-only --diff-filter=AM))
4+
5+
for file in "${files[@]}"; do
6+
if [[ -n "$file" && "$file" == *py ]]; then
7+
# 搜索文件关键词及行数
8+
if grep -Hin TODO "$file"; then
9+
echo "Blocking commit as TODO was found."
10+
exit 1
11+
fi
12+
fi
13+
done

0 commit comments

Comments
 (0)