aboutsummaryrefslogtreecommitdiff
path: root/scripts/maint/practracker
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/maint/practracker')
-rwxr-xr-xscripts/maint/practracker/includes.py10
-rwxr-xr-xscripts/maint/practracker/test_practracker.sh9
-rw-r--r--scripts/maint/practracker/util.py3
3 files changed, 12 insertions, 10 deletions
diff --git a/scripts/maint/practracker/includes.py b/scripts/maint/practracker/includes.py
index a5ee728824..46630d987f 100755
--- a/scripts/maint/practracker/includes.py
+++ b/scripts/maint/practracker/includes.py
@@ -40,11 +40,13 @@ def warn(msg):
print(msg, file=sys.stderr)
def fname_is_c(fname):
- """ Return true iff 'fname' is the name of a file that we should
- search for possibly disallowed #include directives. """
- if fname.endswith(".h") or fname.endswith(".c"):
+ """
+ Return true if 'fname' is the name of a file that we should
+ search for possibly disallowed #include directives.
+ """
+ if fname.endswith((".c", ".h")):
bname = os.path.basename(fname)
- return not (bname.startswith(".") or bname.startswith("#"))
+ return not bname.startswith((".", "#"))
else:
return False
diff --git a/scripts/maint/practracker/test_practracker.sh b/scripts/maint/practracker/test_practracker.sh
index e29b9106de..bb734ad9cd 100755
--- a/scripts/maint/practracker/test_practracker.sh
+++ b/scripts/maint/practracker/test_practracker.sh
@@ -1,15 +1,15 @@
#!/bin/sh
-# Fail if any subprocess fails unexpectedly
+# Fail this script if any subprocess fails unexpectedly.
set -e
umask 077
unset TOR_DISABLE_PRACTRACKER
TMPDIR=""
-clean () {
+clean() {
if [ -n "$TMPDIR" ] && [ -d "$TMPDIR" ]; then
- rm -rf "$TMPDIR"
+ rm -rf "$TMPDIR"
fi
}
trap clean EXIT HUP INT TERM
@@ -27,7 +27,7 @@ PRACTRACKER_DIR="scripts/maint/practracker"
TMPDIR="$(mktemp -d -t pracktracker.test.XXXXXX)"
if test -z "${TMPDIR}" || test ! -d "${TMPDIR}" ; then
echo >&2 "mktemp failed."
- exit 1;
+ exit 1
fi
DATA="${PRACTRACKER_DIR}/testdata"
@@ -43,6 +43,7 @@ run_practracker() {
--terse \
"${DATA}/" "$@" || echo "practracker exit status: $?"
}
+
compare() {
# we can't use cmp because we need to use -b for windows
diff -b -u "$@" > "${TMPDIR}/test-diff" || true
diff --git a/scripts/maint/practracker/util.py b/scripts/maint/practracker/util.py
index c52ca2fbbf..6ab10a8de7 100644
--- a/scripts/maint/practracker/util.py
+++ b/scripts/maint/practracker/util.py
@@ -7,8 +7,7 @@ import os
# We don't want to run metrics for unittests, automatically-generated C files,
# external libraries or git leftovers.
-EXCLUDE_SOURCE_DIRS = {"src/test/", "src/trunnel/", "src/rust/",
- "src/ext/" }
+EXCLUDE_SOURCE_DIRS = {"src/test/", "src/trunnel/", "src/ext/" }
EXCLUDE_FILES = {"orconfig.h"}