summaryrefslogtreecommitdiff
path: root/vendor/aws/aws-crt-php/format-check.sh
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2022-11-23 21:14:33 +0300
committerAndrew Dolgov <[email protected]>2022-11-23 21:14:33 +0300
commit0c8af4992cb0f7589dcafaad65ada12753c64594 (patch)
tree18e83d068c3e7dd2499331de977782b382279396 /vendor/aws/aws-crt-php/format-check.sh
initial
Diffstat (limited to 'vendor/aws/aws-crt-php/format-check.sh')
-rwxr-xr-xvendor/aws/aws-crt-php/format-check.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/vendor/aws/aws-crt-php/format-check.sh b/vendor/aws/aws-crt-php/format-check.sh
new file mode 100755
index 0000000..eb2f524
--- /dev/null
+++ b/vendor/aws/aws-crt-php/format-check.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+if [[ -z $CLANG_FORMAT ]] ; then
+ CLANG_FORMAT=clang-format
+fi
+
+if NOT type $CLANG_FORMAT 2> /dev/null ; then
+ echo "No appropriate clang-format found."
+ exit 1
+fi
+
+FAIL=0
+SOURCE_FILES=`find src ext -type f \( -name '*.c' \)`
+for i in $SOURCE_FILES
+do
+ $CLANG_FORMAT -output-replacements-xml $i | grep -c "<replacement " > /dev/null
+ if [ $? -ne 1 ]
+ then
+ echo "$i failed clang-format check."
+ FAIL=1
+ fi
+done
+
+exit $FAIL