Files
rgbds/.travis-checkpatch.sh
Antonio Niño Díaz a761e98e18 Run checkpatch against origin/master
The develop branch has been deleted. Remove references to it.
2019-05-10 00:16:27 +01:00

46 lines
852 B
Bash
Executable File

#!/bin/bash
echo "Checking code style..."
# Return failure as soon as a command fails to execute
set -e
# Download checkpatch.pl and related files
echo "Getting checkpatch.pl..."
mkdir checkpatchdir
wget https://raw.githubusercontent.com/torvalds/linux/master/scripts/checkpatch.pl
mv checkpatch.pl checkpatchdir/checkpatch.pl
chmod +x checkpatchdir/checkpatch.pl
touch checkpatchdir/const_structs.checkpatch
touch checkpatchdir/spelling.txt
# Run checkpatch.pl on the new commits
echo "Running checkpatch.pl..."
fname=$(mktemp)
rc=0
make CHECKPATCH=checkpatchdir/checkpatch.pl checkpatch > $fname
cat $fname
if grep "ERROR" $fname; then
# At least one error found
echo "Code style errors have been found!"
rc=1
else
echo "No code style errors found, your patches are ready!"
fi
# Cleanup
rm -rf checkpatchdir
exit $rc