diff mbox series

[v3,4/5] ci: make the whitespace report optional

Message ID 20240503172110.181326-5-jltobler@gmail.com (mailing list archive)
State Accepted
Commit 9bef98096c1a58ec0f0e793a282374b50a43eaab
Headers show
Series Add GitLab CI to check for whitespace errors | expand

Commit Message

Justin Tobler May 3, 2024, 5:21 p.m. UTC
The `check-whitespace` CI job generates a formatted output file
containing whitespace error information. As not all CI providers support
rendering a formatted summary, make its generation optional.

Signed-off-by: Justin Tobler <jltobler@gmail.com>
---
 ci/check-whitespace.sh | 45 +++++++++++++++++++++++++++++++-----------
 1 file changed, 33 insertions(+), 12 deletions(-)
diff mbox series

Patch

diff --git a/ci/check-whitespace.sh b/ci/check-whitespace.sh
index 9cc496da40..db399097a5 100755
--- a/ci/check-whitespace.sh
+++ b/ci/check-whitespace.sh
@@ -1,9 +1,20 @@ 
 #!/usr/bin/env bash
+#
+# Check that commits after a specified point do not contain new or modified
+# lines with whitespace errors. An optional formatted summary can be generated
+# by providing an output file path and url as additional arguments.
+#
 
 baseCommit=$1
 outputFile=$2
 url=$3
 
+if test "$#" -ne 1 && test "$#" -ne 3
+then
+	echo "USAGE: $0 <BASE_COMMIT> [<OUTPUT_FILE> <URL>]"
+	exit 1
+fi
+
 problems=()
 commit=
 commitText=
@@ -56,19 +67,29 @@  then
 		goodParent=${baseCommit: 0:7}
 	fi
 
-	echo "