From 96d8555b35b384c2359a3854c9c19c5f7c1c242b Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Tue, 4 Aug 2015 15:02:35 -0400 Subject: [docs] add post commit hook to autopep8 all the things --- docs/leap-autopep8.post-commit.hook | 15 +++++++++++++++ docs/leap-autopep8.post-commit.hook.ADD | 2 ++ 2 files changed, 17 insertions(+) create mode 100755 docs/leap-autopep8.post-commit.hook create mode 100755 docs/leap-autopep8.post-commit.hook.ADD (limited to 'docs') diff --git a/docs/leap-autopep8.post-commit.hook b/docs/leap-autopep8.post-commit.hook new file mode 100755 index 00000000..cffb1d53 --- /dev/null +++ b/docs/leap-autopep8.post-commit.hook @@ -0,0 +1,15 @@ +#!/bin/sh + +# Auto pep8 correction as a post-commit hook. +# Thanks to http://victorlin.me/posts/2014/02/05/auto-post-commit-pep8-correction + +echo "[+] running autopep8..." +FILES=$(git diff HEAD^ HEAD --name-only --diff-filter=ACM | grep -e '\.py$') + +for f in $FILES +do + # auto pep8 correction + autopep8 --in-place $f +done + +git status diff --git a/docs/leap-autopep8.post-commit.hook.ADD b/docs/leap-autopep8.post-commit.hook.ADD new file mode 100755 index 00000000..b6e07ae5 --- /dev/null +++ b/docs/leap-autopep8.post-commit.hook.ADD @@ -0,0 +1,2 @@ + #!/bin/sh + cd .git/hooks && ln -s ../../docs/leap-autopep8.post-commit.hook post-commit -- cgit v1.2.3