
This is a major timesaver for repos the size of nova. This broke recently due to changes in flake8 itself. This removes some needless complexity to make it work again. It also removes the suggestion to use pre-commit which has nothing to do with this target, which also stings more when pre-commit is breaking things which is why you're using this in the first place. Change-Id: Ieb150bf0931ad8031ca83bae1f206075a9f505e2 Signed-off-by: Dan Smith <dansmith@redhat.com>
23 lines
472 B
Bash
Executable File
23 lines
472 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 | grep '.py$' | tr '\n' ' ')
|
|
echo "Running flake8 on ${files}"
|
|
echo ""
|
|
flake8 "$@" $files
|
|
else
|
|
echo "Running flake8 on all files"
|
|
echo ""
|
|
exec flake8 "$@"
|
|
fi
|