Skip to content

Commit c12ee10

Browse files
committed
travis: add astyle run for all changes in the PR
To compare to master, use entire branch, not only files changed.
1 parent 6d427ea commit c12ee10

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

.travis.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,18 +105,21 @@ matrix:
105105
popd;
106106
- astyle --version
107107
script:
108-
# only changed files to be checked for astyle
109-
- git diff --name-only $TRAVIS_BRANCH | grep '.*\.\(h\|c\|hpp\|cpp\)' | fgrep -v -f .astyleignore | xargs -n 100 -I {} bash -c "astyle -n --options=.astylerc \"{}\"" > astyle.out;
110-
if [ $(cat astyle.out | grep Formatted | wc -l) -ne 0 ]; then
108+
# only changed files this time
109+
- git diff --name-only $TRAVIS_BRANCH | grep '.*\.\(h\|c\|hpp\|cpp\)' | fgrep -v -f .astyleignore | xargs -n 100 -I {} bash -c "astyle -n --options=.astylerc \"{}\"" > astyle-files-changed.out;
110+
if [ $(cat astyle-files-changed.out | grep Formatted | wc -l) -ne 0 ]; then
111111
git --no-pager diff;
112112
echo "Please fix style issues as shown above";
113113
else
114114
echo "Coding style check OK";
115115
fi
116116
after_success:
117+
# run astyle for all files on the branch
118+
- git checkout -- .
119+
- find -regex '.*\.\(h\|c\|hpp\|cpp\)' -type f | fgrep -v -f .astyleignore | xargs -n 100 -I {} bash -c "astyle -n --options=.astylerc \"{}\"" > astyle-branch.out;
117120
# update status if we succeeded, compare with master if possible
118121
- |
119-
CURR=$(cat astyle.out | grep Formatted | wc -l)
122+
CURR=$(cat astyle-branch.out | grep Formatted | wc -l)
120123
PREV=$(curl https://api.github.com/repos/$TRAVIS_REPO_SLUG/status/master \
121124
| jq -re "select(.sha != \"$TRAVIS_COMMIT\")
122125
| .statuses[] | select(.context == \"travis-ci/$NAME\").description

0 commit comments

Comments
 (0)