Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit773b42a

Browse files
committed
add pre-commit hook executing yapf
1 parente3492bd commit773b42a

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

‎hooks/install.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
DIR=$(dirname$0)
3+
ln -s -f ../../hooks/pre-commit"$DIR/../.git/hooks/"

‎hooks/pre-commit

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
# capture the changed files that have been staged
4+
changed_files=$(git diff --staged --name-only)
5+
6+
forfilein${changed_files}
7+
do
8+
if [["${file##*.}"=="py" ]];then
9+
echo"Yapfing${file}"
10+
yapf${file} -i
11+
git add${file}
12+
fi
13+
done

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp