From 42e1c32bd664dcafce9f2a9f08068b2ba814df15 Mon Sep 17 00:00:00 2001 From: Pavel 'LEdoian' Turinsky Date: Sat, 20 Aug 2022 07:39:31 +0200 Subject: [PATCH] Add a simple repo-checking tool It is superset of tests, testing repository itself, not only the code. --- repocheck.sh | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100755 repocheck.sh 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