-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpre-commit.sh
executable file
·35 lines (30 loc) · 1002 Bytes
/
pre-commit.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/sh
# some notes to be removed when done:
# FIXME: too aggressive atm, code has to be fixed first [TODO]
# TODO: quick&simple regression tests can be added here
# The full reg.test (atm) needs too much time to run it at every commit
# (due to the nature of the mc-algorithm)
#
# This pre-commit hook verifies the code base regarding naming conventions
# and formatting. Pylint performs also some static code analysis.
# http://www.pylint.org/
#
# Add this script as pre-commit hook to your local git repository:
#
# ln -s ../../pre-commit.sh .git/hooks/pre-commit
#
# Skip the pre-commit hook sometimes:
#
# git commit --no-verify
#
# Hints and recommendation from:
# http://codeinthehole.com/writing/tips-for-using-a-git-pre-commit-hook/
FILES="McSAS.py"
# put local not staged changes aside
git stash -q --keep-index
eval "./run_pylint.sh"
ret_code=$?
# restore local changes not staged yet
git stash pop -q
echo "pre-commit hook exits with code '$ret_code'."
exit $ret_code