summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorDave Hibberd <d@vehibberd.com>2024-01-23 00:29:48 +0000
committerDave Hibberd <d@vehibberd.com>2024-01-23 00:29:48 +0000
commitbd933b3c7d6b702bebb123511ad55adea01fe102 (patch)
tree338699f41163fb2a9727537d4867547424e2dade /tools
parentf5e142a4e54bfda24bec40e923c643b434948a04 (diff)
parent7d3d9d4a1808ea0a76a3263a91de7eee892b42cc (diff)
Merge branch 'master' into 'master'
Master See merge request debian-hamradio-team/chirp!4
Diffstat (limited to 'tools')
-rwxr-xr-xtools/check_commit.sh23
-rwxr-xr-xtools/cpep8.py2
2 files changed, 15 insertions, 10 deletions
diff --git a/tools/check_commit.sh b/tools/check_commit.sh
index 6158a47..5a86e33 100755
--- a/tools/check_commit.sh
+++ b/tools/check_commit.sh
@@ -65,30 +65,35 @@ for file in $(git diff --name-only ${BASE}..); do
fi
done
+#if grep 'def match_model' added_lines; then
+# fail 'New drivers should not have match_model() implemented as it is not needed'
+#fi
+
if git log ${BASE}.. --merges | grep .; then
fail Please do not include merge commits in your PR
fi
make -C chirp/locale clean all >/dev/null 2>&1
-if git diff chirp/locale | grep '^\+[^#+]' | grep -v POT-Creation; then
+if git diff chirp/locale | grep '^+[^#+]' | grep -v POT-Creation; then
fail Locale files need updating
fi
-added_files=$(git diff --name-only --diff-filter=A ${BASE}.. 2>&1)
-if echo $added_files | grep -q chirp.drivers && ! echo $added_files | grep -q tests.images; then
+added_files=$(git diff --name-only --diff-filter=A ${BASE}..)
+added_py=$(git diff --name-only --diff-filter=A ${BASE}.. | grep '\.py$')
+if echo $added_py | grep -q chirp.drivers && ! echo $added_files | grep -q tests.images; then
fail All new drivers should include a test image
fi
existing_drivers=$(git ls-tree --name-only $BASE chirp/drivers/)
-limit=20
-for nf in $added_files; do
+limit=51
+for nf in $added_py; do
for of in $existing_drivers; do
- change=$(wdiff -s $of $nf | grep -I $of | sed -r 's/.* ([0-9]+)% changed/\1/')
- if [ ! "$change" ]; then
+ common=$(wdiff -s $of $nf | grep -I $nf | sed -r 's/.* ([0-9]+)% common.*/\1/')
+ if [ ! "$common" ]; then
continue
fi
- if [ "$change" -lt "$limit" ]; then
- fail "New file $nf shares at least $((100 - $change))% with $of!"
+ if [ "$common" -gt "$limit" ]; then
+ fail "New file $nf shares at least ${common}% with $of!"
fi
done
done
diff --git a/tools/cpep8.py b/tools/cpep8.py
index 678281f..a1fde83 100755
--- a/tools/cpep8.py
+++ b/tools/cpep8.py
@@ -138,7 +138,7 @@ for i in range(0, len(flake8_manifest), 10):
files = flake8_manifest[i:i + 10]
if args.verbose:
print('Checking %s' % files)
- r = subprocess.call(['flake8', '--builtins=_'] + files)
+ r = subprocess.call(['flake8', '--builtins=_,ngettext'] + files)
if r != 0:
total_errors += r