From c597f670127c3e6980145647b5e5168058a137eb Mon Sep 17 00:00:00 2001 From: iphydf Date: Fri, 19 Aug 2016 23:36:49 +0100 Subject: Add format-source script. This is easier to use from a precommit hook, so it can be used to ensure that all formatting is correct before committing code. --- other/astyle/format-source | 9 +++++++++ other/travis/toxcore-script | 6 +++--- 2 files changed, 12 insertions(+), 3 deletions(-) create mode 100755 other/astyle/format-source diff --git a/other/astyle/format-source b/other/astyle/format-source new file mode 100755 index 00000000..4d4b111c --- /dev/null +++ b/other/astyle/format-source @@ -0,0 +1,9 @@ +#!/bin/sh + +if [ -z "$ASTYLE" ]; then + ASTYLE=astyle +fi + +SOURCES=`find . -name "*.[ch]" -and -not -name "*.in.*" -and -not -wholename "*crypto_pwhash*" -and -not -wholename "./super_donators/*"` + +$ASTYLE --options=other/astyle/astylerc $SOURCES diff --git a/other/travis/toxcore-script b/other/travis/toxcore-script index f7de0b70..196fd76e 100755 --- a/other/travis/toxcore-script +++ b/other/travis/toxcore-script @@ -4,10 +4,10 @@ set -e -u -x . other/travis/env-$ENV.sh # Check if toxcore.h and toxav.h match apidsl tox.in.h and toxav.in.h. -../apidsl/_build/apigen.native other/apidsl/tox.in.h | $ASTYLE --options=other/astyle/astylerc > toxcore/tox.h -../apidsl/_build/apigen.native other/apidsl/toxav.in.h | $ASTYLE --options=other/astyle/astylerc > toxav/toxav.h +../apidsl/_build/apigen.native other/apidsl/tox.in.h > toxcore/tox.h +../apidsl/_build/apigen.native other/apidsl/toxav.in.h > toxav/toxav.h # Check if the code is formatted according to the astyle configuration. -$ASTYLE --options=other/astyle/astylerc `find . -name "*.[ch]" -and -not -name "*.in.*" -and -not -wholename "*crypto_pwhash*" -and -not -wholename "./super_donators/*"` +other/astyle/format-source git diff --exit-code # Build toxcore and run tests. -- cgit v1.2.3