800c3dbf93
This was taken from the nova project, fast8 will allow running flake8 tests on a subset of changes (only HEAD) which is quicker. Change-Id: I9069edad75befcd4995a1c23924e2856da56c216 Signed-off-by: Arnaud M <arnaud.morin@gmail.com>
25 lines
515 B
Bash
Executable File
25 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
|
|
# or
|
|
# tox -efast8
|
|
#
|
|
|
|
if test "x$1" = "x-HEAD" ; then
|
|
shift
|
|
files=$(git diff --name-only HEAD~1 | tr '\n' ' ')
|
|
echo "Running flake8 on ${files}"
|
|
echo ""
|
|
diff -u --from-file /dev/null ${files} | flake8 "$@"
|
|
else
|
|
echo "Running flake8 on all files"
|
|
echo ""
|
|
exec flake8 "$@"
|
|
fi
|