summaryrefslogtreecommitdiff
path: root/tools/check_commit.sh
diff options
context:
space:
mode:
authorDave Hibberd <hibby@debian.org>2026-08-20 23:11:02 +0100
committerDave Hibberd <hibby@debian.org>2026-08-20 23:11:02 +0100
commit5f4fe8ab00a12060662e5df0fc8855f0488de35d (patch)
tree95a7d9b81673c059b18a1e551079104050b4ca11 /tools/check_commit.sh
parentdff1a610625ebe7841fca01e20ca6d86b65ee4d0 (diff)
New upstream version 20260814upstream/20260814
Diffstat (limited to 'tools/check_commit.sh')
-rwxr-xr-xtools/check_commit.sh27
1 files changed, 18 insertions, 9 deletions
diff --git a/tools/check_commit.sh b/tools/check_commit.sh
index 9273912..ac95ef5 100755
--- a/tools/check_commit.sh
+++ b/tools/check_commit.sh
@@ -17,28 +17,29 @@ git log --pretty=oneline --no-merges --abbrev-commit ${BASE}..
echo
git diff ${BASE}.. -- '*.py' | grep '^+' > added_lines
+git diff ${BASE}.. -- 'chirp/drivers/*.py' | grep '^+' > driver_lines
-if grep -E '(from|import).*six' added_lines; then
- fail No new uses of future
+if grep -E '\<(from|import)\>.*\<six\>' added_lines; then
+ fail No new uses of six
fi
-if grep -E '\wsix\w' added_lines; then
+if grep -E '\<six\>' added_lines; then
fail No new uses of six
fi
-if grep -E '(from|import).*builtins' added_lines; then
+if grep -E '\<(from|import)\>.*builtins' added_lines; then
fail No new uses of future
fi
-if grep -E '\wfuture\w' added_lines; then
+if grep -E '\<future\>' added_lines; then
fail No new uses of future
fi
-if grep -E '(from|import).*past(?!e)' added_lines; then
+if grep -E '\<(from|import)\>.*\<past\>' added_lines; then
fail Use of past library not allowed
fi
-if grep -E 'MemoryMap\(' added_lines; then
+if grep -E '\<MemoryMap\(' added_lines; then
fail New uses of MemoryMap should be MemoryMapBytes
fi
@@ -46,7 +47,7 @@ if grep -E "[^_]_\([^\"']" added_lines; then
fail 'Translated strings must be literals!'
fi
-if grep -E "eval\(" added_lines; then
+if grep -E "\<eval\(" added_lines; then
fail 'Use of eval() is dangerous and not permitted!'
fi
@@ -73,10 +74,18 @@ done
# fail 'New drivers should not have match_model() implemented as it is not needed'
#fi
-if grep -E '\Wprint\(' added_lines; then
+if grep -E '\<print\(' added_lines; then
fail 'Do not use print()'
fi
+if grep -E '\<(from|import)\>.*wx' driver_lines; then
+ fail 'Drivers may not import GUI components or manipulate the GUI'
+fi
+
+if grep -E '(subprocess|webbrowser)' driver_lines; then
+ fail 'Drivers may not spawn external commands'
+fi
+
if git log ${BASE}.. --merges | grep .; then
fail Please do not include merge commits in your PR
fi