summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2015-08-04 15:02:35 -0400
committerKali Kaneko <kali@leap.se>2015-08-04 15:27:15 -0400
commit96d8555b35b384c2359a3854c9c19c5f7c1c242b (patch)
tree18349f79ec849f17634b223a900302751713adb3 /docs
parentefd5a850fb0938d4bb61f9a73f3608523092bfcf (diff)
[docs] add post commit hook to autopep8 all the things
Diffstat (limited to 'docs')
-rwxr-xr-xdocs/leap-autopep8.post-commit.hook15
-rwxr-xr-xdocs/leap-autopep8.post-commit.hook.ADD2
2 files changed, 17 insertions, 0 deletions
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