zun/tools/flake8wrap.sh
Hongbin Lu 71817c79ab Refactor load_image out of inspect_image
This allows load_image to be reused by others. In addition, reduce
the max-complexity from 10 to 20. Max complexity of 10 is hard to
achieve and much lower than other openstack projects.

Change-Id: I6185e3b8fc5e5b132656ff416e08917edd938fc8
2017-03-08 15:45:31 -06:00

21 lines
515 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 20 --diff "$@"
else
echo "Running flake8 on all files"
exec flake8 --max-complexity 20 "$@"
fi