You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1022 B
Bash

#!/bin/sh
# SPDX-FileCopyrightText: 2022 LEdoian <checklib@pokemon.ledoian.cz>
# 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
has() {
what="$1"
type "$what" >/dev/null 2>&1 && return 0 || return 1
}
red() {
has tput && tput setaf 1 || true # We are OK with dumb terminals
echo "$@"
has tput && tput sgr0 || true
}
if has reuse; then
reuse lint
else
red "REUSE tool not found, skipping"
fi
if has mypy; then
mypy *.py
else
red "Mypy not found, skipping"
fi
if has python3; then
./test.py
else
red 'WTF no python!'
fi