
This normalizes the formatting of files from ci-scripts and config folders in order to allow further hardening of linting. Fixing linting was too big to be made in a single commit as it would involve too many files to review and could merge conflicts with existing changes. Thus doing it in few chunks would makes it possible. Original full change is at https://review.openstack.org/#/c/627545/ and will be the one merging the last. Change-Id: Ifb215c0e2ea0ef7115897721f75ba8489bd59b97
40 lines
608 B
Bash
Executable File
40 lines
608 B
Bash
Executable File
#!/bin/sh
|
|
|
|
# Install this into .git/hooks/pre-commit
|
|
|
|
echo "running commit checks"
|
|
|
|
(
|
|
tmpfile=$(mktemp -t gitXXXXXX)
|
|
trap "rm -f $tmpfile" EXIT
|
|
|
|
for x in ci-scripts/pre-commit.d/*; do
|
|
[ -x "$x" ] || continue
|
|
|
|
tput setaf 3
|
|
printf "%-50s" $x
|
|
tput sgr0
|
|
|
|
if $x > $tmpfile 2>&1 ; then
|
|
tput setaf 2
|
|
printf "[OK]\n"
|
|
tput sgr0
|
|
else
|
|
tput setaf 1
|
|
printf "[OK]\n"
|
|
tput sgr0
|
|
cat $tmpfile >&2
|
|
exit 1
|
|
fi
|
|
done
|
|
)
|
|
|
|
if [ $? -ne 0 ]; then
|
|
tput setaf 1
|
|
echo "*** COMMIT CHECK FAILED ***" >&2
|
|
tput sgr0
|
|
exit 1
|
|
fi
|
|
|
|
exit 0
|