aboutsummaryrefslogtreecommitdiff
path: root/util/pre-commit.py
diff options
context:
space:
mode:
Diffstat (limited to 'util/pre-commit.py')
-rwxr-xr-xutil/pre-commit.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/util/pre-commit.py b/util/pre-commit.py
new file mode 100755
index 0000000..f8242f6
--- /dev/null
+++ b/util/pre-commit.py
@@ -0,0 +1,19 @@
+#!/usr/bin/env python3
+
+import os
+import sys
+import glob
+import license
+
+# stash unstaged files before running test
+os.system("git stash -q --keep-index")
+
+print("Running pre-commit hook in {0}".format(os.getcwd()))
+
+problems = 0
+problems += license.lint("util/header-gpl3.txt", glob.glob("src/**/*.cpp") + glob.glob("src/**/*.h"), True)
+
+# restore stash
+os.system("git stash pop -q")
+
+sys.exit(problems)