diff options
author | iphydf <iphydf@users.noreply.github.com> | 2016-08-19 23:36:49 +0100 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2016-08-20 00:39:18 +0100 |
commit | c597f670127c3e6980145647b5e5168058a137eb (patch) | |
tree | fa88a454996131427baed05f13b1e14bf314ff19 | |
parent | 0e18966a2703d67ac4647832fca595286d8e3568 (diff) |
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.
-rwxr-xr-x | other/astyle/format-source | 9 | ||||
-rwxr-xr-x | other/travis/toxcore-script | 6 |
2 files changed, 12 insertions, 3 deletions
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 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | if [ -z "$ASTYLE" ]; then | ||
4 | ASTYLE=astyle | ||
5 | fi | ||
6 | |||
7 | SOURCES=`find . -name "*.[ch]" -and -not -name "*.in.*" -and -not -wholename "*crypto_pwhash*" -and -not -wholename "./super_donators/*"` | ||
8 | |||
9 | $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 | |||
4 | . other/travis/env-$ENV.sh | 4 | . other/travis/env-$ENV.sh |
5 | 5 | ||
6 | # Check if toxcore.h and toxav.h match apidsl tox.in.h and toxav.in.h. | 6 | # Check if toxcore.h and toxav.h match apidsl tox.in.h and toxav.in.h. |
7 | ../apidsl/_build/apigen.native other/apidsl/tox.in.h | $ASTYLE --options=other/astyle/astylerc > toxcore/tox.h | 7 | ../apidsl/_build/apigen.native other/apidsl/tox.in.h > toxcore/tox.h |
8 | ../apidsl/_build/apigen.native other/apidsl/toxav.in.h | $ASTYLE --options=other/astyle/astylerc > toxav/toxav.h | 8 | ../apidsl/_build/apigen.native other/apidsl/toxav.in.h > toxav/toxav.h |
9 | # Check if the code is formatted according to the astyle configuration. | 9 | # Check if the code is formatted according to the astyle configuration. |
10 | $ASTYLE --options=other/astyle/astylerc `find . -name "*.[ch]" -and -not -name "*.in.*" -and -not -wholename "*crypto_pwhash*" -and -not -wholename "./super_donators/*"` | 10 | other/astyle/format-source |
11 | git diff --exit-code | 11 | git diff --exit-code |
12 | 12 | ||
13 | # Build toxcore and run tests. | 13 | # Build toxcore and run tests. |