summaryrefslogtreecommitdiff
path: root/docs/hooks
diff options
context:
space:
mode:
Diffstat (limited to 'docs/hooks')
-rwxr-xr-xdocs/hooks/leap-autopep8.post-commit.hook15
-rwxr-xr-xdocs/hooks/leap-autopep8.post-commit.hook.ADD2
-rw-r--r--docs/hooks/leap-commit-template7
-rw-r--r--docs/hooks/leap-commit-template.README47
-rwxr-xr-xdocs/hooks/leap-flake8.pre-commit.hook7
5 files changed, 78 insertions, 0 deletions
diff --git a/docs/hooks/leap-autopep8.post-commit.hook b/docs/hooks/leap-autopep8.post-commit.hook
new file mode 100755
index 0000000..cffb1d5
--- /dev/null
+++ b/docs/hooks/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/hooks/leap-autopep8.post-commit.hook.ADD b/docs/hooks/leap-autopep8.post-commit.hook.ADD
new file mode 100755
index 0000000..b6e07ae
--- /dev/null
+++ b/docs/hooks/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
diff --git a/docs/hooks/leap-commit-template b/docs/hooks/leap-commit-template
new file mode 100644
index 0000000..8a5c7cd
--- /dev/null
+++ b/docs/hooks/leap-commit-template
@@ -0,0 +1,7 @@
+[bug|feat|docs|style|refactor|test|pkg|i18n] ...
+...
+
+- Resolves: #XYZ
+- Related: #XYZ
+- Documentation: #XYZ
+- Releases: XYZ
diff --git a/docs/hooks/leap-commit-template.README b/docs/hooks/leap-commit-template.README
new file mode 100644
index 0000000..ce8809e
--- /dev/null
+++ b/docs/hooks/leap-commit-template.README
@@ -0,0 +1,47 @@
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+HOW TO USE THIS TEMPLATE:
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Run `git config commit.template docs/leap-commit-template` or
+edit the .git/config for this project and add
+`template = docs/leap-commit-template`
+under the [commit] block
+
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+COMMIT TEMPLATE FORMAT EXPLAINED
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+[type] <subject>
+
+<body>
+<footer>
+
+Type should be one of the following:
+- bug (bug fix)
+- feat (new feature)
+- docs (changes to documentation)
+- style (formatting, pep8 violations, etc; no code change)
+- refactor (refactoring production code)
+- test (adding missing tests, refactoring tests; no production code change)
+- pkg (packaging related changes; no production code change)
+- i18n translation related changes
+
+Subject should use imperative tone and say what you did.
+For example, use 'change', NOT 'changed' or 'changes'.
+
+The body should go into detail about changes made.
+
+The footer should contain any issue references or actions.
+You can use one or several of the following:
+
+- Resolves: #XYZ
+- Related: #XYZ
+- Documentation: #XYZ
+- Releases: XYZ
+
+The Documentation field should be included in every new feature commit, and it
+should link to an issue in the bug tracker where the new feature is analyzed
+and documented.
+
+For a full example of how to write a good commit message, check out
+https://github.com/sparkbox/how_to/tree/master/style/git
diff --git a/docs/hooks/leap-flake8.pre-commit.hook b/docs/hooks/leap-flake8.pre-commit.hook
new file mode 100755
index 0000000..b00fd08
--- /dev/null
+++ b/docs/hooks/leap-flake8.pre-commit.hook
@@ -0,0 +1,7 @@
+#!/bin/sh
+# Auto-check for pep8 so I don't check in bad code
+FILES=$(git diff --cached --name-only --diff-filter=ACM | grep -e '\.py$')
+
+if [ -n "$FILES" ]; then
+ flake8 -r $FILES
+fi