forked from materialyzeai/m3gnet
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpre-commit
More file actions
executable file
·24 lines (23 loc) · 754 Bytes
/
pre-commit
File metadata and controls
executable file
·24 lines (23 loc) · 754 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/bash
#
# An example hook script to verify what is about to be committed.
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-commit", and copy it
# to your local ".git/hooks" directory
status=0
files=$(git diff --diff-filter=d --cached --name-only | grep -E 'm3gnet.*\.py$' | sed '/test_/d')
files=`echo $files | tr '\n' ' '`
if [ "$files" != " " ]; then
for cmd in pydocstyle mypy flake8 pylint
do
echo "Running $cmd $files..."
$cmd $files
if [ $? -ne 0 ]; then
echo "$cmd failed. Fix before commit."
exit 1
fi
done
fi