Skip to content

Commit

Permalink
scripts: checkcode: Guess the source directory if no argument is prov…
Browse files Browse the repository at this point in the history
…ided

I always forgot to do that...

Signed-off-by: Jan Kiszka <[email protected]>
  • Loading branch information
jan-kiszka committed Feb 16, 2024
1 parent 46d364f commit 5d0d379
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions scripts/checkcode.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,21 @@
ERROR=0

if [ $# != 1 ]; then
echo "Error: Please provide a path as the argument to this script!"
exit 1
SRCDIR=$(dirname "$0")/..
else
SRCDIR=$1
fi

echo "Checking with pycodestyle"
pycodestyle --ignore=W503,W606 "$1"/*.py "$1"/*/*.py || ERROR=$((ERROR + 1))
pycodestyle --ignore=W503,W606 "$SRCDIR"/*.py "$SRCDIR"/*/*.py || ERROR=$((ERROR + 1))

echo "Checking with flake8"
flake8 "$1" || ERROR=$((ERROR + 2))
flake8 "$SRCDIR" || ERROR=$((ERROR + 2))

echo "Checking with doc8"
doc8 "$1"/docs --ignore-path "$1"/docs/_build || ERROR=$((ERROR + 4))
doc8 "$SRCDIR"/docs --ignore-path "$SRCDIR"/docs/_build || ERROR=$((ERROR + 4))

echo "Checking with shellcheck"
shellcheck "$1"/kas-container "$1"/scripts/release.sh "$1"/scripts/checkcode.sh "$1"/container-entrypoint || ERROR=$((ERROR + 8))
shellcheck "$SRCDIR"/kas-container "$SRCDIR"/scripts/release.sh "$SRCDIR"/scripts/checkcode.sh "$SRCDIR"/container-entrypoint || ERROR=$((ERROR + 8))

exit $ERROR

0 comments on commit 5d0d379

Please sign in to comment.