summaryrefslogtreecommitdiff
path: root/rdns_scan/zmap4rdns/checkFormat.sh
diff options
context:
space:
mode:
Diffstat (limited to 'rdns_scan/zmap4rdns/checkFormat.sh')
-rw-r--r--rdns_scan/zmap4rdns/checkFormat.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/rdns_scan/zmap4rdns/checkFormat.sh b/rdns_scan/zmap4rdns/checkFormat.sh
new file mode 100644
index 0000000..566bb48
--- /dev/null
+++ b/rdns_scan/zmap4rdns/checkFormat.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+CLANG_FORMAT=clang-format-6.0
+
+files_to_lint=$(find ./src ./lib -type f -name '*.c' -or -name '*.h')
+
+fail=0
+for f in ${files_to_lint}; do
+ d="$(diff -u "$f" <($CLANG_FORMAT -style=file "$f") || true)"
+ if ! [ -z "$d" ]; then
+ printf "The file %s is not compliant with the coding style:\n%s\n" "$f" "$d"
+ fail=1
+ fi
+done
+
+if [ "$fail" -eq "1" ]; then
+ if [ ! -z $ZMAP_ENFORCE_FORMAT ]; then
+ exit 1
+ fi
+fi