Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/utils.sh')
-rw-r--r--scripts/utils.sh31
1 files changed, 24 insertions, 7 deletions
diff --git a/scripts/utils.sh b/scripts/utils.sh
index 92f647958fe..c71de666ac6 100644
--- a/scripts/utils.sh
+++ b/scripts/utils.sh
@@ -109,21 +109,38 @@ function install_junit_merge_gem() {
function fail_on_warnings() {
local cmd="$*"
- local warnings
- warnings="$(mktemp)"
+ local warning_file
+ warning_file="$(mktemp)"
+
+ local allowed_warning_file
+ allowed_warning_file="$(mktemp)"
- eval "$cmd 2>$warnings"
+ eval "$cmd 2>$warning_file"
local ret=$?
- if test -s "$warnings";
+ # Filter out comments and empty lines from allowed warnings file.
+ grep --invert-match --extended-regexp "^#|^$" scripts/allowed_warnings.txt > "$allowed_warning_file"
+
+ local warnings
+ # Filter out allowed warnings from stderr.
+ # Turn grep errors into warnings so we fail later.
+ warnings=$(grep --invert-match --extended-regexp --file "$allowed_warning_file" "$warning_file" 2>&1 || true)
+
+ rm -f "$allowed_warning_file"
+
+ if [ "$warnings" != "" ]
then
echoerr "There were warnings:"
- cat "$warnings"
- rm "$warnings"
+ echoerr "======================== Filtered warnings ====================================="
+ echo "$warnings" >&2
+ echoerr "======================= Unfiltered warnings ===================================="
+ cat "$warning_file" >&2
+ echoerr "================================================================================"
+ rm -f "$warning_file"
return 1
fi
- rm "$warnings"
+ rm -f "$warning_file"
return $ret
}