aboutsummaryrefslogtreecommitdiff
path: root/util/pre-commit.py
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2017-02-01 17:18:08 +0100
committerAqua-sama <aqua@iserlohn-fortress.net>2017-02-01 17:18:08 +0100
commite6cc0a2b756f1462bcce2222437a6e159be48498 (patch)
tree2bab92eb8777a0f531fe42309f388330916987f1 /util/pre-commit.py
parentCleaned up UrlLineEdit (diff)
downloadsmolbote-e6cc0a2b756f1462bcce2222437a6e159be48498.tar.xz
Updated license script
Added missing license headers Added pre-commit hook to check for missing licenses
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)