zun/tools/flake8wrap.sh
Andreas Jaeger 3fe89808c6 Update hacking for Python3
The repo is Python 3 now, so update hacking to version 3.0 which
supports Python 3.

Fix problems found.

Update local hacking checks for new flake8.

Remove hacking and friends from lower-constraints, they are not needed
to be installed at run-time.

Fix flake8wrap to take arguments from tox.ini and not look at .tox
directory.

Change-Id: I1c5f5a85af02d9f11e475b6088fe1d9d9d252083
2020-04-02 10:28:00 +02:00

21 lines
517 B
Bash
Executable File

#!/bin/sh
#
# A simple wrapper around flake8 which makes it possible
# to ask it to only verify files changed in the current
# git HEAD patch.
#
# Intended to be invoked via tox:
#
# tox -epep8 -- -HEAD
#
if test "x$1" = "x-HEAD" ; then
shift
files=$(git diff --name-only HEAD~1 | tr '\n' ' ')
echo "Running flake8 on ${files}"
diff -u --from-file /dev/null ${files} | flake8 --max-complexity 34 --exclude zun/criapi --diff "$@"
else
echo "Running flake8 on all files"
exec flake8 "$@"
fi