Skip to content

Commit

Permalink
Check PRs for coding style issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
slav-at-attachix committed Jun 7, 2018
1 parent 21a137a commit 57c790a
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ script:
fi
- export PATH=$PATH:$ESP_HOME/xtensa-lx106-elf/bin:$ESP_HOME/utils/:$SMING_HOME/../.travis/tools
- cd $SMING_HOME
- if [ "$SDK_VERSION" == "2.0.0" ]; then ../.travis/tools/clang/format-pr.sh; fi
- make test
- cd $SMING_HOME/../
- export SMING_HAS_CHANGED=`for i in $CHANGED_FILES; do if [[ $i == Sming/* ]]; then
Expand Down
File renamed without changes.
27 changes: 27 additions & 0 deletions .travis/tools/clang/format-pr.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

# Script taken from here: https://github.com/citra-emu/citra
# and is distributed under the same license as the original script

# Default clang-format points to default 3.5 version one
CLANG_FORMAT=clang-format
$CLANG_FORMAT --version

cd $SMING_HOME/..

# Get list of modified files
files_to_lint="$(git diff --name-only --diff-filter=ACMRTUXB $TRAVIS_COMMIT_RANGE | grep '^[^.]*[.]\(c\|cpp\|h\)$' | grep -e Sming/SmingCore -e samples || true)"

for f in $files_to_lint; do

d=$(diff -u "$f" <($CLANG_FORMAT "$f") || true)
if ! [ -z "$d" ]; then
echo "!!! $f not compliant to coding style, here is the fix:"
echo "$d"
fail=1
fi
done

if [ "$fail" = 1 ]; then
exit 1
fi

0 comments on commit 57c790a

Please sign in to comment.