From 3c488101de525bf649604cc9cfb8e37739220fe7 Mon Sep 17 00:00:00 2001 From: Ralph Seichter Date: Wed, 21 Feb 2024 14:51:55 +0100 Subject: [PATCH] Add shell script checks --- Makefile | 8 ++++++++ contrib/package.sh | 6 +++--- contrib/unittest.sh | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index e28e802..f937840 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,9 @@ The following make targets are available: clean Cleanup build directories. dist Build distribution files. help Show this text. + push Push to all configured Git remotes. pypi Upload distribution files to PyPI. + schk Shell script check. stest Run sandboxed Python tests (disables network tests). test Run all Python tests and generate coverage report. @@ -43,3 +45,9 @@ stest: test: env NETWORK_TESTS=1 $(unittest) coverage + +push: + for _r in $(shell git remote); do git push $$_r; done; unset _r + +schk: + shellcheck -x contrib/*.sh diff --git a/contrib/package.sh b/contrib/package.sh index e18e077..8da4030 100755 --- a/contrib/package.sh +++ b/contrib/package.sh @@ -10,7 +10,7 @@ set -euo pipefail function usage() { local bn - bn="$(basename $0)" + bn="$(basename "$0")" echo "Usage: ${bn} {clean | dist | pypi}" >&2 echo " ${bn} setver {version}" >&2 exit 1 @@ -41,11 +41,11 @@ arg="${1}" shift case "${arg}" in clean) - do_${arg} + do_"${arg}" ;; dist|setver|pypi) . .venv/bin/activate - do_${arg} "$@" + do_"${arg}" "$@" ;; *) usage diff --git a/contrib/unittest.sh b/contrib/unittest.sh index 7b3d867..ca20262 100755 --- a/contrib/unittest.sh +++ b/contrib/unittest.sh @@ -25,7 +25,7 @@ CONF='tests/tests.conf' sed -i'' -e "s,^db_url.*,db_url = sqlite:///${DB}," $CONF function usage() { - echo "Usage: $(basename $0) [coverage]" >&2 + echo "Usage: $(basename "$0") [coverage]" >&2 exit 1 }