File tree 2 files changed +33
-0
lines changed
2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
You can’t perform that action at this time.
0 commit comments