2015-01-06 00:16:30 -04:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -eu
|
|
|
|
failed=0
|
2015-09-05 13:20:59 -03:00
|
|
|
for fn in $(find src/examples \
|
|
|
|
src/systemcmds \
|
2015-09-06 07:03:09 -03:00
|
|
|
src/include \
|
2015-10-19 08:36:29 -03:00
|
|
|
src/drivers \
|
|
|
|
src/platforms \
|
2015-10-19 10:04:12 -03:00
|
|
|
src/firmware \
|
2015-09-05 17:18:38 -03:00
|
|
|
src/lib/launchdetection \
|
2015-10-19 10:04:12 -03:00
|
|
|
src/lib/geo \
|
|
|
|
src/lib/geo_lookup \
|
|
|
|
src/lib/conversion \
|
|
|
|
src/lib/rc \
|
|
|
|
src/lib/version \
|
|
|
|
src/modules/attitude_estimator_q \
|
2015-12-11 04:53:32 -04:00
|
|
|
src/modules/fw_att_control \
|
2015-10-19 10:04:12 -03:00
|
|
|
src/modules/gpio_led \
|
|
|
|
src/modules/land_detector \
|
|
|
|
src/modules/muorb \
|
|
|
|
src/modules/px4iofirmware \
|
|
|
|
src/modules/param \
|
|
|
|
src/modules/sensors \
|
|
|
|
src/modules/simulator \
|
|
|
|
src/modules/uORB \
|
2015-09-05 17:18:38 -03:00
|
|
|
src/modules/bottle_drop \
|
|
|
|
src/modules/dataman \
|
|
|
|
src/modules/segway \
|
2015-10-24 11:57:46 -03:00
|
|
|
src/modules/local_position_estimator \
|
2015-09-06 07:00:30 -03:00
|
|
|
src/modules/unit_test \
|
|
|
|
src/modules/systemlib \
|
2015-10-21 19:25:37 -03:00
|
|
|
src/modules/controllib \
|
2015-09-05 13:20:59 -03:00
|
|
|
-path './Build' -prune -o \
|
2015-08-22 17:25:47 -03:00
|
|
|
-path './mavlink' -prune -o \
|
|
|
|
-path './NuttX' -prune -o \
|
2015-03-27 20:08:44 -03:00
|
|
|
-path './src/lib/eigen' -prune -o \
|
2015-08-22 17:25:47 -03:00
|
|
|
-path './src/lib/mathlib/CMSIS' -prune -o \
|
2015-10-14 02:33:08 -03:00
|
|
|
-path './src/modules/uavcan/libuavcan' -prune -o \
|
2015-03-02 21:49:27 -04:00
|
|
|
-path './src/modules/attitude_estimator_ekf/codegen' -prune -o \
|
2015-08-22 17:25:47 -03:00
|
|
|
-path './src/modules/ekf_att_pos_estimator' -prune -o \
|
|
|
|
-path './src/modules/sdlog2' -prune -o \
|
|
|
|
-path './src/modules/uORB' -prune -o \
|
|
|
|
-path './src/modules/vtol_att_control' -prune -o \
|
2015-02-22 18:41:02 -04:00
|
|
|
-path './unittests/build' -prune -o \
|
2015-08-22 17:25:47 -03:00
|
|
|
-path './unittests/gtest' -prune -o \
|
2015-09-06 07:00:30 -03:00
|
|
|
-name '*.c' -o -name '*.cpp' -o -name '*.hpp' -o -name '*.h' \
|
|
|
|
-not -name '*generated*' \
|
|
|
|
-not -name '*uthash.h' \
|
|
|
|
-not -name '*utstring.h' \
|
|
|
|
-not -name '*utlist.h' \
|
|
|
|
-not -name '*utarray.h' \
|
|
|
|
-type f); do
|
2015-01-06 00:16:30 -04:00
|
|
|
if [ -f "$fn" ];
|
|
|
|
then
|
|
|
|
./Tools/fix_code_style.sh --quiet < $fn > $fn.pretty
|
|
|
|
diffsize=$(diff -y --suppress-common-lines $fn $fn.pretty | wc -l)
|
|
|
|
rm -f $fn.pretty
|
|
|
|
if [ $diffsize -ne 0 ]; then
|
|
|
|
failed=1
|
2015-08-22 17:25:47 -03:00
|
|
|
echo $fn 'bad formatting, please run "./Tools/fix_code_style.sh' $fn'"'
|
2015-01-06 00:16:30 -04:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ $failed -eq 0 ]; then
|
|
|
|
echo "Format checks passed"
|
|
|
|
exit 0
|
|
|
|
else
|
2015-08-22 17:25:47 -03:00
|
|
|
echo "Format checks failed"
|
2015-01-06 00:16:30 -04:00
|
|
|
exit 1
|
|
|
|
fi
|