cinder/tools/fast8.sh
Stephen Finucane 6b3b9ccdeb trivial: Remove trailing spaces, mixed tabs/spaces
We also remove "empty" JSON bodies since they don't show anything useful
and can't be linted.

PS: Don't worry about us changing release notes: reno has handled this
for some time and only cares about when the note was added (or deleted),
not when it was changed.

Change-Id: I869f6e4a47af3ef3168978bdb03f387d5bb2947f
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2024-09-18 13:52:28 +01:00

33 lines
779 B
Bash
Executable File

#!/bin/bash
NUM_COMMITS=${FAST8_NUM_COMMITS:-1}
if [[ $NUM_COMMITS = "smart" ]]; then
# Run on all commits not submitted yet
# (sort of -- only checks vs. "master" since this is easy)
NUM_COMMITS=$(git cherry master | wc -l)
fi
echo "Checking last $NUM_COMMITS commits."
cd $(dirname "$0")/..
CHANGED=""
CHANGED+="$(git diff --name-only HEAD~${NUM_COMMITS} \*.py | tr '\n' ' ')"
while [[ -z $CHANGED ]]; do
# Search back until we find a commit containing python files
NUM_COMMITS=$((NUM_COMMITS + 1))
CHANGED+="$(git diff --name-only HEAD~${NUM_COMMITS} \*.py | tr '\n' ' ')" ;
done
# Skip files that don't exist
# (have been git rm'd)
CHECK=""
for FILE in $CHANGED; do
if [ -f "$FILE" ]; then
CHECK+="$FILE "
fi
done
flake8 $CHECK