diff --git a/repocheck.sh b/repocheck.sh new file mode 100755 index 0000000..491a31b --- /dev/null +++ b/repocheck.sh @@ -0,0 +1,38 @@ +#!/bin/sh + +# SPDX-FileCopyrightText: 2022 LEdoian +# SPDX-License-Identifier: CC0-1.0 + +# This is a simple script to check correctness/compliance of the repository as +# a whole. This is different from tests (test.py), which deal only with +# corectness of the code. This also checks the code using other tools, which do +# not directly impact the code, but try to minimize technical debt. + +# I know that there are more sophisticated tools. This seemed sufficient and +# lightweight enough, so I didn't look further. You can try to convince me +# otherwise, please write me an email. + +set -e + +red() { + tput setaf 1 + echo "$@" + tput sgr0 +} + +has_reuse=$(type reuse >/dev/null 2>&1 && echo true || echo false) +if $has_reuse; then + reuse lint +else + red "REUSE tool not found, skipping" +fi + + +has_mypy=$(type mypy >/dev/null 2>&1 && echo true || echo false) +if $has_mypy; then + mypy *.py +else + red "Mypy not found, skipping" +fi + +./test.py