aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts
diff options
context:
space:
mode:
authorGravatar Paul Beusterien <paulbeusterien@google.com>2018-01-21 13:48:26 -0800
committerGravatar GitHub <noreply@github.com>2018-01-21 13:48:26 -0800
commitc4feb513be9c768e812e50c8cb139179b7e83565 (patch)
tree96b9fbfeb95e734258ac6eaabb220b4009ceee12 /scripts
parentcd0cbe94d0bcb0f6a64b90b74ab3f7ce126a1a6d (diff)
style.sh - output unformatted files in test-only and ignore generated config.h (#690)
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/style.sh18
1 files changed, 15 insertions, 3 deletions
diff --git a/scripts/style.sh b/scripts/style.sh
index 96255f9..1b41b13 100755
--- a/scripts/style.sh
+++ b/scripts/style.sh
@@ -36,6 +36,7 @@ else
options="-i"
fi
+files=$(
(
if [[ $# -gt 0 ]]; then
if git rev-parse "$1" -- >& /dev/null; then
@@ -58,6 +59,9 @@ fi
\%/third_party/% d
\%/Firestore/Port/% d
+# Generated source
+\%/Firestore/core/src/firebase/firestore/util/config.h% d
+
# Sources pulled in by travis bundler
\%/vendor/bundle/% d
@@ -69,10 +73,18 @@ fi
# Format C-ish sources only
\%\.(h|m|mm|cc)$% p
-' | xargs clang-format -style=file $options \
- | grep "<replacement " > /dev/null
+'
+)
+needs_formatting=false
+for f in $files; do
+ clang-format -style=file $options $f | grep "<replacement " > /dev/null
+ if [[ "$test_only" = true && $? -ne 1 ]]; then
+ echo "$f needs formatting."
+ needs_formatting=true
+ fi
+done
-if [[ "$test_only" = true && $? -ne 1 ]]; then
+if [[ "$needs_formatting" = true ]]; then
echo "Proposed commit is not style compliant."
echo "Run scripts/style.sh and git add the result."
exit 1