d31df7042a
Rather than requiring changes to a static list of header files, use the GNU Make wildcard function to generate a .cpp file per header. This also tests whether each header includes all of the system headers for the types it uses. Change-Id: I05b82510b194533672568019e138d7d1aad2e86b Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
38 lines
927 B
Bash
Executable File
38 lines
927 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
readonly BASEDIR=$(readlink -f $(dirname $0))/..
|
|
cd $BASEDIR
|
|
|
|
# exit on errors
|
|
set -e
|
|
|
|
if hash astyle; then
|
|
echo -n "Checking coding style..."
|
|
rm -f astyle.log
|
|
touch astyle.log
|
|
astyle --options=.astylerc "*.c" >> astyle.log
|
|
astyle --options=.astylerc --exclude=test/cpp_headers "*.cpp" >> astyle.log
|
|
astyle --options=.astylerc "*.h" >> astyle.log
|
|
if grep -q "^Formatted" astyle.log; then
|
|
echo " errors detected"
|
|
git diff
|
|
sed -i -e 's/ / /g' astyle.log
|
|
grep --color=auto "^Formatted.*" astyle.log
|
|
echo "Incorrect code style detected in one or more files."
|
|
echo "The files have been automatically formatted."
|
|
echo "Remember to add the files to your commit."
|
|
rm -f astyle.log
|
|
exit 1
|
|
fi
|
|
echo " OK"
|
|
rm -f astyle.log
|
|
else
|
|
echo "You do not have astyle installed so your code style is not being checked!"
|
|
exit 0
|
|
fi
|
|
|
|
git grep -I -l -e . -z | \
|
|
xargs -0 -P8 -n1 scripts/eofnl
|
|
|
|
exit 0
|