mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
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.
This commit is contained in:
parent
0e18966a27
commit
c597f67012
9
other/astyle/format-source
Executable file
9
other/astyle/format-source
Executable file
|
@ -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
|
|
@ -4,10 +4,10 @@ set -e -u -x
|
||||||
. other/travis/env-$ENV.sh
|
. other/travis/env-$ENV.sh
|
||||||
|
|
||||||
# Check if toxcore.h and toxav.h match apidsl tox.in.h and toxav.in.h.
|
# 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/tox.in.h > 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/toxav.in.h > toxav/toxav.h
|
||||||
# Check if the code is formatted according to the astyle configuration.
|
# 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
|
git diff --exit-code
|
||||||
|
|
||||||
# Build toxcore and run tests.
|
# Build toxcore and run tests.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user