yetus-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject [yetus] branch master updated: YETUS-873. Error on unprocessed options/parameters (#53)
Date Mon, 13 May 2019 17:24:24 GMT
This is an automated email from the ASF dual-hosted git repository.

aw pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/yetus.git


The following commit(s) were added to refs/heads/master by this push:
     new 601c145  YETUS-873. Error on unprocessed options/parameters (#53)
601c145 is described below

commit 601c145a024f81aed189c319673b2e1c8a3d9e7e
Author: Allen Wittenauer <aw@apache.org>
AuthorDate: Mon May 13 10:24:20 2019 -0700

    YETUS-873. Error on unprocessed options/parameters (#53)
---
 precommit/src/main/shell/core.d/01-common.sh       | 48 +++++++++++++++
 precommit/src/main/shell/core.d/docker.sh          | 14 +++++
 precommit/src/main/shell/core.d/reaper.sh          |  3 +
 precommit/src/main/shell/docker-cleanup.sh         | 27 ++++++++
 precommit/src/main/shell/personality/hadoop.sh     |  3 +
 precommit/src/main/shell/personality/jmeter.sh     |  1 +
 precommit/src/main/shell/smart-apply-patch.sh      | 35 +++++++++++
 precommit/src/main/shell/test-patch.d/ant.sh       |  1 +
 .../src/main/shell/test-patch.d/asflicense.sh      |  2 +
 precommit/src/main/shell/test-patch.d/author.sh    |  1 +
 precommit/src/main/shell/test-patch.d/autoconf.sh  |  1 +
 .../src/main/shell/test-patch.d/briefreport.sh     |  2 +
 precommit/src/main/shell/test-patch.d/bugzilla.sh  |  1 +
 .../src/main/shell/test-patch.d/checkstyle.sh      |  1 +
 precommit/src/main/shell/test-patch.d/cmake.sh     |  3 +
 precommit/src/main/shell/test-patch.d/github.sh    |  5 ++
 precommit/src/main/shell/test-patch.d/gitlab.sh    |  4 ++
 precommit/src/main/shell/test-patch.d/gradle.sh    |  2 +
 precommit/src/main/shell/test-patch.d/htmlout.sh   |  1 +
 precommit/src/main/shell/test-patch.d/jira.sh      |  5 ++
 precommit/src/main/shell/test-patch.d/jshint.sh    |  1 +
 precommit/src/main/shell/test-patch.d/junit.sh     |  3 +
 precommit/src/main/shell/test-patch.d/make.sh      |  3 +
 precommit/src/main/shell/test-patch.d/maven.sh     |  5 ++
 precommit/src/main/shell/test-patch.d/pathlen.sh   |  1 +
 .../src/main/shell/test-patch.d/perlcritic.sh      |  1 +
 precommit/src/main/shell/test-patch.d/pylint.sh    |  5 ++
 precommit/src/main/shell/test-patch.d/rubocop.sh   |  2 +
 precommit/src/main/shell/test-patch.d/shelldocs.sh |  1 +
 precommit/src/main/shell/test-patch.d/slack.sh     |  1 +
 precommit/src/main/shell/test-patch.d/spotbugs.sh  |  2 +
 precommit/src/main/shell/test-patch.d/tap.sh       |  1 +
 precommit/src/main/shell/test-patch.d/unitveto.sh  |  1 +
 .../src/main/shell/test-patch.d/whitespace.sh      |  2 +
 precommit/src/main/shell/test-patch.sh             | 71 +++++++++++++++++++++-
 35 files changed, 259 insertions(+), 1 deletion(-)

diff --git a/precommit/src/main/shell/core.d/01-common.sh b/precommit/src/main/shell/core.d/01-common.sh
index 8ced491..054d1cc 100755
--- a/precommit/src/main/shell/core.d/01-common.sh
+++ b/precommit/src/main/shell/core.d/01-common.sh
@@ -31,6 +31,7 @@ function common_defaults
   EXEC_MODES=()
   #shellcheck disable=SC2034
   EXCLUDE_PATHS=()
+  IGNORE_UNKNOWN_OPTIONS=false
   ROBOTTYPE=""
   LOAD_SYSTEM_PLUGINS=true
   #shellcheck disable=SC2034
@@ -60,6 +61,7 @@ function common_defaults
   ROBOT=false
   #shellcheck disable=SC2034
   SENTINEL=false
+
   #shellcheck disable=SC2034
   TESTTYPES=()
   TESTFORMATS=()
@@ -116,92 +118,122 @@ function common_args
   for i in "$@"; do
     case ${i} in
       --awk-cmd=*)
+        delete_parameter "${i}"
         AWK=${i#*=}
       ;;
       --basedir=*)
+        delete_parameter "${i}"
         #shellcheck disable=SC2034
         BASEDIR=${i#*=}
       ;;
       --branch=*)
+        delete_parameter "${i}"
         #shellcheck disable=SC2034
         PATCH_BRANCH=${i#*=}
       ;;
       --branch-default=*)
+        delete_parameter "${i}"
         #shellcheck disable=SC2034
         PATCH_BRANCH_DEFAULT=${i#*=}
       ;;
       --curl-cmd=*)
+        delete_parameter "${i}"
         CURL=${i#*=}
       ;;
       --debug)
+        delete_parameter "${i}"
         #shellcheck disable=SC2034
         YETUS_SHELL_SCRIPT_DEBUG=true
       ;;
       --diff-cmd=*)
+        delete_parameter "${i}"
         DIFF=${i#*=}
       ;;
       --file-cmd=*)
+        delete_parameter "${i}"
         FILE=${i#*=}
       ;;
       --git-cmd=*)
+        delete_parameter "${i}"
         GIT=${i#*=}
       ;;
       --git-offline)
+        delete_parameter "${i}"
         #shellcheck disable=SC2034
         GIT_OFFLINE=true
       ;;
       --git-shallow)
+        delete_parameter "${i}"
         #shellcheck disable=SC2034
         GIT_SHALLOW=true
       ;;
       --grep-cmd=*)
+        delete_parameter "${i}"
         GREP=${i#*=}
       ;;
+      --ignore-unknown-options=*)
+        delete_parameter "${i}"
+        #shellcheck disable=SC2034
+        IGNORE_UNKNOWN_OPTIONS=${i#*=}
+      ;;
       --help|-help|-h|help|--h|--\?|-\?|\?)
+        delete_parameter "${i}"
         showhelp=true
       ;;
       --list-plugins)
+        delete_parameter "${i}"
         list_plugins
         exit 0
       ;;
       --offline)
+        delete_parameter "${i}"
         #shellcheck disable=SC2034
         OFFLINE=true
         #shellcheck disable=SC2034
         GIT_OFFLINE=true
       ;;
       --patch-cmd=*)
+        delete_parameter "${i}"
         PATCH=${i#*=}
       ;;
       --patch-dir=*)
+        delete_parameter "${i}"
         PATCH_DIR=${i#*=}
       ;;
       --plugins=*)
+        delete_parameter "${i}"
         ENABLED_PLUGINS=${i#*=}
         ENABLED_PLUGINS=${ENABLED_PLUGINS//,/ }
       ;;
       --project=*)
+        delete_parameter "${i}"
         PROJECT_NAME=${i#*=}
       ;;
       --rsync-cmd=*)
+        delete_parameter "${i}"
         RSYNC=${i#*=}
       ;;
       --skip-system-plugins)
+        delete_parameter "${i}"
         LOAD_SYSTEM_PLUGINS=false
       ;;
       --sed-cmd=*)
+        delete_parameter "${i}"
         SED=${i#*=}
       ;;
       --stat-cmd=*)
+        delete_parameter "${i}"
         # This is used by Docker-in-Docker mode presently, but if other
         # things end up needing it later, it's better to just put it here
         #shellcheck disable=SC2034
         STAT=${i#*=}
       ;;
       --user-plugins=*)
+        delete_parameter "${i}"
         USER_PLUGIN_DIR=${i#*=}
       ;;
       --version)
+        delete_parameter "${i}"
         showversion=true
       ;;
       *)
@@ -809,4 +841,20 @@ function generate_stack
     ((frame++));
   done
   exit 1
+}
+
+## @description  remove entries from paramater tracker
+## @audience     public
+## @stability    stable
+## @replaceable  no
+## @param        parameter
+function delete_parameter
+{
+  declare i=$1
+
+  if [[ "${i}" =~ = ]]; then
+    i=${i%=*}
+  fi
+
+  yetus_del_array_element PARAMETER_TRACKER "${i}"
 }
\ No newline at end of file
diff --git a/precommit/src/main/shell/core.d/docker.sh b/precommit/src/main/shell/core.d/docker.sh
index 49d9e60..92515b7 100755
--- a/precommit/src/main/shell/core.d/docker.sh
+++ b/precommit/src/main/shell/core.d/docker.sh
@@ -90,47 +90,61 @@ function docker_parse_args
   for i in "$@"; do
     case ${i} in
       --docker)
+        delete_parameter "${i}"
         DOCKERSUPPORT=true
       ;;
       --docker-bash-debug=*)
+        delete_parameter "${i}"
         YETUS_DOCKER_BASH_DEBUG=${i#*=}
         add_docker_env YETUS_DOCKER_BASH_DEBUG
       ;;
       --docker-cache-from=*)
+        delete_parameter "${i}"
         DOCKER_CACHE_FROM=${i#*=}
       ;;
       --dockercmd=*)
+        delete_parameter "${i}"
         #shellcheck disable=SC2034
         DOCKERCMD=${i#*=}
       ;;
       --dockerdelrep)
+        delete_parameter "${i}"
         DOCKER_DESTRUCTIVE=false
       ;;
       --dockerfile=*)
+        delete_parameter "${i}"
         DOCKERFILE=${i#*=}
       ;;
       --dockerind=*)
+        delete_parameter "${i}"
         DOCKER_IN_DOCKER=${i#*=}
       ;;
       --dockermemlimit=*)
+        delete_parameter "${i}"
         DOCKER_MEMORY=${i#*=}
       ;;
       --dockermode)
+        delete_parameter "${i}"
         DOCKERMODE=true
       ;;
       --docker-platform=*)
+        delete_parameter "${i}"
         DOCKER_PLATFORM=${i#*=}
       ;;
       --dockerprivd=*)
+        delete_parameter "${i}"
         DOCKER_ENABLE_PRIVILEGED=${i#*=}
       ;;
       --docker-socket=*)
+        delete_parameter "${i}"
         DOCKER_SOCKET=${i#*=}
       ;;
       --docker-tag=*)
+        delete_parameter "${i}"
         DOCKER_TAG=${i#*=}
       ;;
       --docker-work-dir=*)
+        delete_parameter "${i}"
         DOCKER_TAG=${i#*=}
       ;;
     esac
diff --git a/precommit/src/main/shell/core.d/reaper.sh b/precommit/src/main/shell/core.d/reaper.sh
index 5ba03e7..0a3e88a 100755
--- a/precommit/src/main/shell/core.d/reaper.sh
+++ b/precommit/src/main/shell/core.d/reaper.sh
@@ -56,12 +56,15 @@ function reaper_parse_args
   for i in "$@"; do
     case ${i} in
       --reapermode=*)
+        delete_parameter "${i}"
         REAPER_MODE=${i#*=}
       ;;
       --reaperdockeronly=*)
+        delete_parameter "${i}"
         REAPER_DOCKER_ONLY=${i#*=}
       ;;
       --reapernames=*)
+        delete_parameter "${i}"
         yetus_comma_to_array REAPER_NAMES "${i#*=}"
       ;;
     esac
diff --git a/precommit/src/main/shell/docker-cleanup.sh b/precommit/src/main/shell/docker-cleanup.sh
index 3173993..968c2e0 100755
--- a/precommit/src/main/shell/docker-cleanup.sh
+++ b/precommit/src/main/shell/docker-cleanup.sh
@@ -134,10 +134,12 @@ function parse_args
   for i in "$@"; do
     case ${i} in
       --robot)
+        delete_parameter "${i}"
         # shellcheck disable=SC2034
         ROBOT=true
       ;;
       --sentinel)
+        delete_parameter "${i}"
         # shellcheck disable=SC2034
         ROBOT=true
         # shellcheck disable=SC2034
@@ -161,6 +163,7 @@ function yetus_usage
   echo "${BINNAME} [OPTIONS]"
 
   yetus_add_option "--debug" "If set, then output some extra stuff to stderr"
+  yetus_add_option "--ignore-unknown-options=<bool>" "Continue despite unknown options
(default: ${IGNORE_UNKNOWN_OPTIONS})"
   yetus_add_option "--robot" "Assume this is an automated run"
   yetus_add_option "--sentinel" "A very aggressive robot (auto: --robot)"
   docker_usage
@@ -188,8 +191,25 @@ function big_console_header
   printf '\n\n'
 }
 
+## @description setup the parameter tracker for param errors
+## @audience    private
+## @stability   evolving
+function setup_parameter_tracker
+{
+  declare i
+
+  for i in "${USER_PARAMS[@]}"; do
+    if [[ "${i}" =~ ^-- ]]; then
+      i=${i%=*}
+      PARAMETER_TRACKER+=("${i}")
+    fi
+  done
+}
+
 trap "cleanup_and_exit 1" HUP INT QUIT TERM
 
+setup_parameter_tracker
+
 import_core
 
 setup_defaults
@@ -200,6 +220,13 @@ import_and_clean
 
 parse_args_plugins "$@"
 
+if [[ "${#PARAMETER_TRACKER}" -gt 0 ]]; then
+  yetus_error "ERROR: Unprocessed flag(s): ${PARAMETER_TRACKER[*]}"
+  if [[ "${IGNORE_UNKNOWN_OPTIONS}" == false ]]; then
+    cleanup_and_exit 1
+  fi
+fi
+
 docker_initialize
 plugins_initialize
 
diff --git a/precommit/src/main/shell/personality/hadoop.sh b/precommit/src/main/shell/personality/hadoop.sh
index 6e1a800..49ed9e3 100755
--- a/precommit/src/main/shell/personality/hadoop.sh
+++ b/precommit/src/main/shell/personality/hadoop.sh
@@ -49,12 +49,15 @@ function personality_parse_args
   for i in "$@"; do
     case ${i} in
       --hadoop-isal-prefix=*)
+        delete_parameter "${i}"
         ISAL_HOME=${i#*=}
       ;;
       --hadoop-openssl-prefix=*)
+        delete_parameter "${i}"
         OPENSSL_HOME=${i#*=}
       ;;
       --hadoop-snappy-prefix=*)
+        delete_parameter "${i}"
         SNAPPY_HOME=${i#*=}
       ;;
     esac
diff --git a/precommit/src/main/shell/personality/jmeter.sh b/precommit/src/main/shell/personality/jmeter.sh
index b4f524c..788a304 100755
--- a/precommit/src/main/shell/personality/jmeter.sh
+++ b/precommit/src/main/shell/personality/jmeter.sh
@@ -52,6 +52,7 @@ function jmeter_parse_args
   for i in "$@"; do
     case ${i} in
       --jmeter-download-jars=*)
+        delete_parameter "${i}"
         JMETER_DOWNLOAD_JARS=${i#*=}
       ;;
     esac
diff --git a/precommit/src/main/shell/smart-apply-patch.sh b/precommit/src/main/shell/smart-apply-patch.sh
index 20a7e57..2567ee5 100755
--- a/precommit/src/main/shell/smart-apply-patch.sh
+++ b/precommit/src/main/shell/smart-apply-patch.sh
@@ -120,6 +120,7 @@ function yetus_usage
   yetus_add_option "--committer" "Apply patches like a boss."
   yetus_add_option "--debug" "If set, then output some extra stuff to stderr"
   yetus_add_option "--dry-run" "Check for patch viability without applying"
+  yetus_add_option "--ignore-unknown-options=<bool>" "Continue despite unknown options
(default: ${IGNORE_UNKNOWN_OPTIONS})"
   yetus_add_option "--list-plugins" "List all installed plug-ins and then exit"
   yetus_add_option "--modulelist=<list>" "Specify additional modules to test (comma
delimited)"
   yetus_add_option "--offline" "Avoid connecting to the Internet"
@@ -193,27 +194,35 @@ function parse_args
   for i in "$@"; do
     case ${i} in
       --build-tool=*)
+        delete_parameter "${i}"
         BUILDTOOL=${i#*=}
       ;;
       --committer)
+        delete_parameter "${i}"
         COMMITMODE=true
       ;;
       --gpg-sign)
+        delete_parameter "${i}"
         GPGSIGN=true
       ;;
       --dry-run)
+        delete_parameter "${i}"
         PATCH_DRYRUNMODE=true
       ;;
       --changedfilesreport=*)
+        delete_parameter "${i}"
         FILEREPORT=${i#*=}
       ;;
       --changedmodulesreport=*)
+        delete_parameter "${i}"
         MODULEREPORT=${i#*=}
       ;;
       --changedunionreport=*)
+        delete_parameter "${i}"
         UNIONREPORT=${i#*=}
       ;;
       --report-only)
+        delete_parameter "${i}"
         REPORTONLY=true
       ;;
       --*)
@@ -383,8 +392,27 @@ function import_core
   done
 }
 
+## @description setup the parameter tracker for param errors
+## @audience    private
+## @stability   evolving
+function setup_parameter_tracker
+{
+  declare i
+
+  for i in "${USER_PARAMS[@]}"; do
+    if [[ "${i}" =~ ^-- ]]; then
+      i=${i%=*}
+      PARAMETER_TRACKER+=("${i}")
+    fi
+  done
+}
+
 trap "cleanup_and_exit 1" HUP INT QUIT TERM
 
+# robots will change USER_PARAMS so must
+# do this before importing other code
+setup_parameter_tracker
+
 import_core
 
 setup_defaults
@@ -400,6 +428,13 @@ TESTFORMATS=()
 
 parse_args_plugins "$@"
 
+if [[ "${#PARAMETER_TRACKER}" -gt 0 ]]; then
+  yetus_error "ERROR: Unprocessed flag(s): ${PARAMETER_TRACKER[*]}"
+  if [[ "${IGNORE_UNKNOWN_OPTIONS}" == false ]]; then
+    cleanup_and_exit 1
+  fi
+fi
+
 plugins_initialize
 
 locate_patch
diff --git a/precommit/src/main/shell/test-patch.d/ant.sh b/precommit/src/main/shell/test-patch.d/ant.sh
index d7ab534..bb1ebc3 100755
--- a/precommit/src/main/shell/test-patch.d/ant.sh
+++ b/precommit/src/main/shell/test-patch.d/ant.sh
@@ -39,6 +39,7 @@ function ant_parse_args
   for i in "$@"; do
     case ${i} in
       --ant-cmd=*)
+        delete_parameter "${i}"
         ANT=${i#*=}
       ;;
     esac
diff --git a/precommit/src/main/shell/test-patch.d/asflicense.sh b/precommit/src/main/shell/test-patch.d/asflicense.sh
index 0c22070..bdc41ea 100755
--- a/precommit/src/main/shell/test-patch.d/asflicense.sh
+++ b/precommit/src/main/shell/test-patch.d/asflicense.sh
@@ -31,9 +31,11 @@ function asflicense_parse_args
   for i in "$@"; do
     case ${i} in
       --asflicense-rat-excludes=*)
+        delete_parameter "${i}"
         ASFLICENSE_RAT_EXCLUDES=${i#*=}
       ;;
       --asflicense-rat-jar=*)
+        delete_parameter "${i}"
         ASFLICENSE_RAT_JAR=${i#*=}
       ;;
     esac
diff --git a/precommit/src/main/shell/test-patch.d/author.sh b/precommit/src/main/shell/test-patch.d/author.sh
index 423e31f..dd05fa6 100755
--- a/precommit/src/main/shell/test-patch.d/author.sh
+++ b/precommit/src/main/shell/test-patch.d/author.sh
@@ -36,6 +36,7 @@ function author_parse_args
   for i in "$@"; do
     case ${i} in
       --author-ignore-list=*)
+        delete_parameter "${i}"
         yetus_comma_to_array AUTHOR_IGNORE_LIST "${i#*=}"
       ;;
     esac
diff --git a/precommit/src/main/shell/test-patch.d/autoconf.sh b/precommit/src/main/shell/test-patch.d/autoconf.sh
index bf9476d..6e73696 100755
--- a/precommit/src/main/shell/test-patch.d/autoconf.sh
+++ b/precommit/src/main/shell/test-patch.d/autoconf.sh
@@ -36,6 +36,7 @@ function autoconf_parse_args
   for i in "$@"; do
     case ${i} in
       --autoconf-configure-flags=*)
+        delete_parameter "${i}"
         AUTOCONF_CONF_FLAGS=${i#*=}
       ;;
     esac
diff --git a/precommit/src/main/shell/test-patch.d/briefreport.sh b/precommit/src/main/shell/test-patch.d/briefreport.sh
index 1780164..1d66618 100755
--- a/precommit/src/main/shell/test-patch.d/briefreport.sh
+++ b/precommit/src/main/shell/test-patch.d/briefreport.sh
@@ -44,9 +44,11 @@ function briefreport_parse_args
   for i in "$@"; do
     case ${i} in
       --brief-report-file=*)
+        delete_parameter "${i}"
         fn=${i#*=}
       ;;
       --brief-report-long=*)
+        delete_parameter "${i}"
         BRIEFOUT_LONGRUNNING=${i#*=}
       ;;
     esac
diff --git a/precommit/src/main/shell/test-patch.d/bugzilla.sh b/precommit/src/main/shell/test-patch.d/bugzilla.sh
index d7f8f17..2e6ebda 100755
--- a/precommit/src/main/shell/test-patch.d/bugzilla.sh
+++ b/precommit/src/main/shell/test-patch.d/bugzilla.sh
@@ -34,6 +34,7 @@ function bugzilla_parse_args
   for i in "$@"; do
     case ${i} in
       --bugzilla-base-url=*)
+        delete_parameter "${i}"
         BUGZILLA_BASE_URL=${i#*=}
       ;;
     esac
diff --git a/precommit/src/main/shell/test-patch.d/checkstyle.sh b/precommit/src/main/shell/test-patch.d/checkstyle.sh
index 59f3b97..bec3efd 100755
--- a/precommit/src/main/shell/test-patch.d/checkstyle.sh
+++ b/precommit/src/main/shell/test-patch.d/checkstyle.sh
@@ -58,6 +58,7 @@ function checkstyle_parse_args
   for i in "$@"; do
     case ${i} in
     --checkstyle-goal=*)
+      delete_parameter "${i}"
       CHECKSTYLE_GOAL=${i#*=}
         case ${CHECKSTYLE_GOAL} in
         check)
diff --git a/precommit/src/main/shell/test-patch.d/cmake.sh b/precommit/src/main/shell/test-patch.d/cmake.sh
index a77da38..5b5343d 100755
--- a/precommit/src/main/shell/test-patch.d/cmake.sh
+++ b/precommit/src/main/shell/test-patch.d/cmake.sh
@@ -42,12 +42,15 @@ function cmake_parse_args
   for i in "$@"; do
     case ${i} in
       --cmake-build-dir=*)
+        delete_parameter "${i}"
         CMAKE_BUILD_DIR=${i#*=}
       ;;
       --cmake-cmd=*)
+        delete_parameter "${i}"
         CMAKE=${i#*=}
       ;;
       --cmake-root-build=*)
+        delete_parameter "${i}"
         CMAKE_ROOT_BUILD=${i#*=}
       ;;
     esac
diff --git a/precommit/src/main/shell/test-patch.d/github.sh b/precommit/src/main/shell/test-patch.d/github.sh
index d0446be..5ccb5ae 100755
--- a/precommit/src/main/shell/test-patch.d/github.sh
+++ b/precommit/src/main/shell/test-patch.d/github.sh
@@ -69,18 +69,23 @@ function github_parse_args
   for i in "$@"; do
     case ${i} in
       --github-api-url=*)
+        delete_parameter "${i}"
         GITHUB_API_URL=${i#*=}
       ;;
       --github-base-url=*)
+        delete_parameter "${i}"
         GITHUB_BASE_URL=${i#*=}
       ;;
       --github-repo=*)
+        delete_parameter "${i}"
         GITHUB_REPO=${i#*=}
       ;;
       --github-password=*)
+        delete_parameter "${i}"
         GITHUB_PASSWD=${i#*=}
       ;;
       --github-user=*)
+        delete_parameter "${i}"
         GITHUB_USER=${i#*=}
       ;;
     esac
diff --git a/precommit/src/main/shell/test-patch.d/gitlab.sh b/precommit/src/main/shell/test-patch.d/gitlab.sh
index 595d444..e012895 100755
--- a/precommit/src/main/shell/test-patch.d/gitlab.sh
+++ b/precommit/src/main/shell/test-patch.d/gitlab.sh
@@ -55,15 +55,19 @@ function gitlab_parse_args
   for i in "$@"; do
     case ${i} in
       --gitlab-disable-write)
+        delete_parameter "${i}"
         GITLAB_WRITE_ENABLED=false
       ;;
       --gitlab-token=*)
+        delete_parameter "${i}"
         GITLAB_TOKEN=${i#*=}
       ;;
       --gitlab-repo=*)
+        delete_parameter "${i}"
         GITLAB_REPO=${i#*=}
       ;;
       --gitlab-url=*)
+        delete_parameter "${i}"
         GITLAB_BASE_URL=${i#*=}
       ;;
     esac
diff --git a/precommit/src/main/shell/test-patch.d/gradle.sh b/precommit/src/main/shell/test-patch.d/gradle.sh
index 45142e9..4946360 100755
--- a/precommit/src/main/shell/test-patch.d/gradle.sh
+++ b/precommit/src/main/shell/test-patch.d/gradle.sh
@@ -34,9 +34,11 @@ function gradle_parse_args
   for i in "$@"; do
     case ${i} in
       --gradle-cmd=*)
+        delete_parameter "${i}"
         GRADLE=${i#*=}
       ;;
       --gradlew-cmd=*)
+        delete_parameter "${i}"
         GRADLEW=${i#*=}
       ;;
     esac
diff --git a/precommit/src/main/shell/test-patch.d/htmlout.sh b/precommit/src/main/shell/test-patch.d/htmlout.sh
index 9d34886..9290836 100755
--- a/precommit/src/main/shell/test-patch.d/htmlout.sh
+++ b/precommit/src/main/shell/test-patch.d/htmlout.sh
@@ -38,6 +38,7 @@ function htmlout_parse_args
   for i in "$@"; do
     case ${i} in
       --html-report-file=*)
+        delete_parameter "${i}"
         fn=${i#*=}
       ;;
     esac
diff --git a/precommit/src/main/shell/test-patch.d/jira.sh b/precommit/src/main/shell/test-patch.d/jira.sh
index c13c5f2..d3d7737 100755
--- a/precommit/src/main/shell/test-patch.d/jira.sh
+++ b/precommit/src/main/shell/test-patch.d/jira.sh
@@ -60,18 +60,23 @@ function jira_parse_args
   for i in "$@"; do
     case ${i} in
       --jira-base-url=*)
+        delete_parameter "${i}"
         JIRA_URL=${i#*=}
       ;;
       --jira-issue-re=*)
+        delete_parameter "${i}"
         JIRA_ISSUE_RE=${i#*=}
       ;;
       --jira-password=*)
+        delete_parameter "${i}"
         JIRA_PASSWD=${i#*=}
       ;;
       --jira-status-re=*)
+        delete_parameter "${i}"
         JIRA_STATUS_RE=${i#*=}
       ;;
       --jira-user=*)
+        delete_parameter "${i}"
         JIRA_USER=${i#*=}
       ;;
     esac
diff --git a/precommit/src/main/shell/test-patch.d/jshint.sh b/precommit/src/main/shell/test-patch.d/jshint.sh
index cc4efc5..8578b09 100755
--- a/precommit/src/main/shell/test-patch.d/jshint.sh
+++ b/precommit/src/main/shell/test-patch.d/jshint.sh
@@ -38,6 +38,7 @@ function jshint_parse_args
   for i in "$@"; do
     case ${i} in
       --jshint-cmd=*)
+        delete_parameter "${i}"
         JSHINT=${i#*=}
       ;;
     esac
diff --git a/precommit/src/main/shell/test-patch.d/junit.sh b/precommit/src/main/shell/test-patch.d/junit.sh
index c1a0c55..3d44883 100755
--- a/precommit/src/main/shell/test-patch.d/junit.sh
+++ b/precommit/src/main/shell/test-patch.d/junit.sh
@@ -39,12 +39,15 @@ function junit_parse_args
   for i in "$@"; do
     case ${i} in
       --junit-test-output=*)
+        delete_parameter "${i}"
         JUNIT_TEST_OUTPUT_DIR=${i#*=}
       ;;
       --junit-test-prefix=*)
+        delete_parameter "${i}"
         JUNIT_TEST_PREFIX=${i#*=}
       ;;
       --junit-results-xml=*)
+        delete_parameter "${i}"
         JUNIT_RESULTS_XML=${i#*=}
       ;;
     esac
diff --git a/precommit/src/main/shell/test-patch.d/make.sh b/precommit/src/main/shell/test-patch.d/make.sh
index 7093029..35bbb1a 100755
--- a/precommit/src/main/shell/test-patch.d/make.sh
+++ b/precommit/src/main/shell/test-patch.d/make.sh
@@ -58,12 +58,15 @@ function make_parse_args
   for i in "$@"; do
     case ${i} in
       --make-cmd=*)
+        delete_parameter "${i}"
         MAKE=${i#*=}
       ;;
       --make-file=*)
+        delete_parameter "${i}"
         MAKEFILE=${i#*=}
       ;;
       --make-use-git-clean)
+        delete_parameter "${i}"
         MAKE_GITCLEAN=true
       ;;
     esac
diff --git a/precommit/src/main/shell/test-patch.d/maven.sh b/precommit/src/main/shell/test-patch.d/maven.sh
index 53d3417..09690ee 100755
--- a/precommit/src/main/shell/test-patch.d/maven.sh
+++ b/precommit/src/main/shell/test-patch.d/maven.sh
@@ -93,18 +93,23 @@ function maven_parse_args
   for i in "$@"; do
     case ${i} in
       --mvn-cmd=*)
+        delete_parameter "${i}"
         MAVEN=${i#*=}
       ;;
       --mvn-custom-repos)
+        delete_parameter "${i}"
         MAVEN_CUSTOM_REPOS=true
       ;;
       --mvn-custom-repos-dir=*)
+        delete_parameter "${i}"
         MAVEN_CUSTOM_REPOS_DIR=${i#*=}
       ;;
       --mvn-deps-order=*)
+        delete_parameter "${i}"
         MAVEN_DEPENDENCY_ORDER=${i#*=}
       ;;
       --mvn-settings=*)
+        delete_parameter "${i}"
         MAVEN_SETTINGS=${i#*=}
         if [[ -f ${MAVEN_SETTINGS} ]]; then
           MAVEN_ARGS=("${MAVEN_ARGS[@]}" "--settings=${MAVEN_SETTINGS}")
diff --git a/precommit/src/main/shell/test-patch.d/pathlen.sh b/precommit/src/main/shell/test-patch.d/pathlen.sh
index a013adb..f056003 100755
--- a/precommit/src/main/shell/test-patch.d/pathlen.sh
+++ b/precommit/src/main/shell/test-patch.d/pathlen.sh
@@ -39,6 +39,7 @@ function pathlen_parse_args
   for i in "$@"; do
     case ${i} in
       --pathlen-size=*)
+        delete_parameter "${i}"
         PATHLEN_SIZE="${i#*=}"
       ;;
     esac
diff --git a/precommit/src/main/shell/test-patch.d/perlcritic.sh b/precommit/src/main/shell/test-patch.d/perlcritic.sh
index 5c09a05..8290378 100755
--- a/precommit/src/main/shell/test-patch.d/perlcritic.sh
+++ b/precommit/src/main/shell/test-patch.d/perlcritic.sh
@@ -34,6 +34,7 @@ function perlcritic_parse_args
   for i in "$@"; do
     case ${i} in
     --perlcritic=*)
+      delete_parameter "${i}"
       PERLCRITIC=${i#*=}
     ;;
     esac
diff --git a/precommit/src/main/shell/test-patch.d/pylint.sh b/precommit/src/main/shell/test-patch.d/pylint.sh
index 0f0e30b..d0a83bf 100755
--- a/precommit/src/main/shell/test-patch.d/pylint.sh
+++ b/precommit/src/main/shell/test-patch.d/pylint.sh
@@ -42,18 +42,23 @@ function pylint_parse_args
   for i in "$@"; do
     case ${i} in
     --pylint=*)
+      delete_parameter "${i}"
       PYLINT=${i#*=}
     ;;
     --pylint-pip-cmd=*)
+      delete_parameter "${i}"
       PYLINT_PIP_CMD=${i#*=}
     ;;
     --pylint-rcfile=*)
+      delete_parameter "${i}"
       PYLINT_RCFILE=${i#*=}
     ;;
     --pylint-requirements=*)
+      delete_parameter "${i}"
       PYLINT_REQUIREMENTS=${i#*=}
     ;;
     --pylint-use-user=*)
+      delete_parameter "${i}"
       PYLINT_PIP_USER=${i#*=}
     ;;
     esac
diff --git a/precommit/src/main/shell/test-patch.d/rubocop.sh b/precommit/src/main/shell/test-patch.d/rubocop.sh
index 84a9fe0..143d038 100755
--- a/precommit/src/main/shell/test-patch.d/rubocop.sh
+++ b/precommit/src/main/shell/test-patch.d/rubocop.sh
@@ -35,9 +35,11 @@ function rubocop_parse_args
   for i in "$@"; do
     case ${i} in
     --rubocop=*)
+      delete_parameter "${i}"
       RUBOCOP=${i#*=}
     ;;
     --rubocop-config=*)
+      delete_parameter "${i}"
       RUBOCOP_CONFIG=${i#*=}
     ;;
     esac
diff --git a/precommit/src/main/shell/test-patch.d/shelldocs.sh b/precommit/src/main/shell/test-patch.d/shelldocs.sh
index 0d47dc4..082e85b 100755
--- a/precommit/src/main/shell/test-patch.d/shelldocs.sh
+++ b/precommit/src/main/shell/test-patch.d/shelldocs.sh
@@ -48,6 +48,7 @@ function shelldocs_parse_args
   for i in "$@"; do
     case ${i} in
     --shelldocs=*)
+      delete_parameter "${i}"
       SHELLDOCS=${i#*=}
     ;;
     esac
diff --git a/precommit/src/main/shell/test-patch.d/slack.sh b/precommit/src/main/shell/test-patch.d/slack.sh
index d63255c..15ba393 100755
--- a/precommit/src/main/shell/test-patch.d/slack.sh
+++ b/precommit/src/main/shell/test-patch.d/slack.sh
@@ -36,6 +36,7 @@ function slack_parse_args
   for i in "$@"; do
     case ${i} in
       --slack-webhook-url=*)
+        delete_parameter "${i}"
         SLACK_WEBHOOK_URL=${i#*=}
       ;;
     esac
diff --git a/precommit/src/main/shell/test-patch.d/spotbugs.sh b/precommit/src/main/shell/test-patch.d/spotbugs.sh
index e43bab4..45a9ac9 100755
--- a/precommit/src/main/shell/test-patch.d/spotbugs.sh
+++ b/precommit/src/main/shell/test-patch.d/spotbugs.sh
@@ -56,9 +56,11 @@ function spotbugs_parse_args
   for i in "$@"; do
     case ${i} in
     --spotbugs-home=*)
+      delete_parameter "${i}"
       SPOTBUGS_HOME=${i#*=}
     ;;
     --spotbugs-strict-precheck)
+      delete_parameter "${i}"
       SPOTBUGS_WARNINGS_FAIL_PRECHECK=true
     ;;
     esac
diff --git a/precommit/src/main/shell/test-patch.d/tap.sh b/precommit/src/main/shell/test-patch.d/tap.sh
index 08d5242..fa2ec9f 100755
--- a/precommit/src/main/shell/test-patch.d/tap.sh
+++ b/precommit/src/main/shell/test-patch.d/tap.sh
@@ -28,6 +28,7 @@ function tap_parse_args
   for i in "$@"; do
     case ${i} in
       --tap-log-dir=*)
+        delete_parameter "${i}"
         TAP_LOG_DIR=${i#=*}
       ;;
     esac
diff --git a/precommit/src/main/shell/test-patch.d/unitveto.sh b/precommit/src/main/shell/test-patch.d/unitveto.sh
index fd88ec5..ab758a3 100755
--- a/precommit/src/main/shell/test-patch.d/unitveto.sh
+++ b/precommit/src/main/shell/test-patch.d/unitveto.sh
@@ -43,6 +43,7 @@ function unitveto_parse_args
   for i in "$@"; do
     case ${i} in
       --unitveto-re=*)
+        delete_parameter "${i}"
         UNITVETO_RE=${i#*=}
       ;;
     esac
diff --git a/precommit/src/main/shell/test-patch.d/whitespace.sh b/precommit/src/main/shell/test-patch.d/whitespace.sh
index df08a37..6d3b682 100755
--- a/precommit/src/main/shell/test-patch.d/whitespace.sh
+++ b/precommit/src/main/shell/test-patch.d/whitespace.sh
@@ -42,9 +42,11 @@ function whitespace_parse_args
   for i in "$@"; do
     case ${i} in
       --whitespace-eol-ignore-list=*)
+        delete_parameter "${i}"
         WHITESPACE_EOL_IGNORE_LIST="${i#*=}"
       ;;
       --whitespace-tabs-ignore-list=*)
+        delete_parameter "${i}"
         WHITESPACE_TABS_IGNORE_LIST="${i#*=}"
       ;;
     esac
diff --git a/precommit/src/main/shell/test-patch.sh b/precommit/src/main/shell/test-patch.sh
index 4daacf5..27d5f98 100755
--- a/precommit/src/main/shell/test-patch.sh
+++ b/precommit/src/main/shell/test-patch.sh
@@ -29,6 +29,7 @@ BINNAME=${this##*/}
 BINNAME=${BINNAME%.sh}
 STARTINGDIR=$(pwd)
 USER_PARAMS=("$@")
+
 #shellcheck disable=SC2034
 QATESTMODE=false
 
@@ -686,6 +687,7 @@ function yetus_usage
   yetus_add_option "--excludes=<file>" "File of regexs to keep project files out of
the set of changes passed to plugins."
   yetus_add_option "--git-offline" "Do not fail if git cannot do certain remote operations"
   yetus_add_option "--git-shallow" "Repo does not know about other branches or tags"
+  yetus_add_option "--ignore-unknown-options=<bool>" "Continue despite unknown options
(default: ${IGNORE_UNKNOWN_OPTIONS})"
   yetus_add_option "--java-home=<path>" "Set JAVA_HOME (In Docker mode, this should
be local to the image)"
   yetus_add_option "--linecomments=<bug>" "Only write line comments to this comma delimited
list (default: same as --bugcomments)"
   yetus_add_option "--list-plugins" "List all installed plug-ins and then exit"
@@ -783,59 +785,76 @@ function parse_args
   for i in "$@"; do
     case ${i} in
       --archive-list=*)
+        delete_parameter "${i}"
         yetus_comma_to_array ARCHIVE_LIST "${i#*=}"
         yetus_debug "Set to archive: ${ARCHIVE_LIST[*]}"
       ;;
       --bugcomments=*)
+        delete_parameter "${i}"
         BUGCOMMENTS=${i#*=}
         BUGCOMMENTS=${BUGCOMMENTS//,/ }
       ;;
       --build-native=*)
+        delete_parameter "${i}"
         BUILD_NATIVE=${i#*=}
       ;;
       --build-tool=*)
+        delete_parameter "${i}"
         BUILDTOOL=${i#*=}
       ;;
       --build-url=*)
+        delete_parameter "${i}"
         BUILD_URL=${i#*=}
       ;;
       --build-url-artifacts=*)
+        delete_parameter "${i}"
         # shellcheck disable=SC2034
         BUILD_URL_ARTIFACTS=${i#*=}
       ;;
       --build-url-console=*)
+        delete_parameter "${i}"
         # shellcheck disable=SC2034
         BUILD_URL_CONSOLE=${i#*=}
       ;;
       --console-report-file=*)
+        delete_parameter "${i}"
         CONSOLE_REPORT_FILE=${i#*=}
       ;;
       --console-urls)
+        delete_parameter "${i}"
         # shellcheck disable=SC2034
         CONSOLE_USE_BUILD_URL=true
       ;;
       --contrib-guide=*)
+        delete_parameter "${i}"
         PATCH_NAMING_RULE=${i#*=}
       ;;
       --continuous-improvement=*)
+        delete_parameter "${i}"
         CONTINUOUS_IMPROVEMENT=${i#*=}
       ;;
       --dirty-workspace)
+        delete_parameter "${i}"
         DIRTY_WORKSPACE=true
       ;;
       --excludes=*)
+        delete_parameter "${i}"
         EXCLUDE_PATHS_FILE="${i#*=}"
       ;;
       --instance=*)
+        delete_parameter "${i}"
         INSTANCE=${i#*=}
       ;;
       --empty-patch)
+        delete_parameter "${i}"
         BUILDMODE=full
       ;;
       --java-home=*)
+        delete_parameter "${i}"
         JAVA_HOME=${i#*=}
       ;;
       --linecomments=*)
+        delete_parameter "${i}"
         BUGLINECOMMENTS=${i#*=}
         BUGLINECOMMENTS=${BUGLINECOMMENTS//,/ }
         if [[ -z "${BUGLINECOMMENTS}" ]]; then
@@ -843,76 +862,97 @@ function parse_args
         fi
       ;;
       --modulelist=*)
+        delete_parameter "${i}"
         yetus_comma_to_array USER_MODULE_LIST "${i#*=}"
         yetus_debug "Manually forcing modules ${USER_MODULE_LIST[*]}"
       ;;
       --multijdkdirs=*)
+        delete_parameter "${i}"
         yetus_comma_to_array JDK_DIR_LIST "${i#*=}"
         yetus_debug "Multi-JDK mode activated with ${JDK_DIR_LIST[*]}"
         yetus_add_array_element EXEC_MODES MultiJDK
       ;;
       --multijdktests=*)
+        delete_parameter "${i}"
         yetus_comma_to_array JDK_TEST_LIST "${i#*=}"
         yetus_debug "MultiJDK test list=${JDK_TEST_LIST[*]}"
       ;;
       --mv-patch-dir)
+        delete_parameter "${i}"
         RELOCATE_PATCH_DIR=true;
       ;;
       --personality=*)
+        delete_parameter "${i}"
         PERSONALITY=${i#*=}
       ;;
       --proclimit=*)
+        delete_parameter "${i}"
         PROC_LIMIT=${i#*=}
       ;;
       --reexec)
+        delete_parameter "${i}"
         REEXECED=true
       ;;
       --resetrepo)
+        delete_parameter "${i}"
         RESETREPO=true
       ;;
       --robot)
+        delete_parameter "${i}"
         ROBOT=true
       ;;
       --run-tests)
+        delete_parameter "${i}"
         RUN_TESTS=true
       ;;
       --sentinel)
+        delete_parameter "${i}"
         # shellcheck disable=SC2034
         SENTINEL=true
         yetus_add_array_element EXEC_MODES Sentinel
       ;;
       --skip-dirs=*)
+        delete_parameter "${i}"
         MODULE_SKIPDIRS=${i#*=}
         MODULE_SKIPDIRS=${MODULE_SKIPDIRS//,/ }
         yetus_debug "Setting skipdirs to ${MODULE_SKIPDIRS}"
       ;;
       --summarize=*)
+        delete_parameter "${i}"
         ALLOWSUMMARIES=${i#*=}
       ;;
       --test-parallel=*)
+        delete_parameter "${i}"
         # shellcheck disable=SC2034
         TEST_PARALLEL=${i#*=}
       ;;
       --test-threads=*)
+        delete_parameter "${i}"
         # shellcheck disable=SC2034
         TEST_THREADS=${i#*=}
       ;;
       --unit-test-filter-file=*)
+        delete_parameter "${i}"
         UNIT_TEST_FILTER_FILE=${i#*=}
       ;;
       --tests-filter=*)
+        delete_parameter "${i}"
         yetus_comma_to_array VOTE_FILTER "${i#*=}"
       ;;
       --tpglobaltimer=*)
+        delete_parameter "${i}"
         GLOBALTIMER=${i#*=}
       ;;
       --tpinstance=*)
+        delete_parameter "${i}"
         INSTANCE=${i#*=}
       ;;
       --tpperson=*)
+        delete_parameter "${i}"
         REEXECPERSONALITY=${i#*=}
       ;;
       --tpreexectimer=*)
+        delete_parameter "${i}"
         REEXECLAUNCHTIMER=${i#*=}
       ;;
       --*)
@@ -3059,7 +3099,6 @@ function initialize
     BUGCOMMENTS="${BUGCOMMENTS} console"
   fi
 
-
   if [[ "${BUGLINECOMMENTS}" == " " ]]; then
     BUGLINECOMMENTS=""
   else
@@ -3107,6 +3146,17 @@ function initialize
 
   check_reexec
 
+  if [[ "${#PARAMETER_TRACKER}" -gt 0 ]]; then
+    yetus_error "ERROR: Unprocessed flag(s): ${PARAMETER_TRACKER[*]}"
+    if [[ "${IGNORE_UNKNOWN_OPTIONS}" == true ]]; then
+      add_vote_table "-0" yetus "Unprocessed flag(s): ${PARAMETER_TRACKER[*]}"
+    else
+      add_vote_table -1 yetus "Unprocessed flag(s): ${PARAMETER_TRACKER[*]}"
+      bugsystem_finalreport 1
+      cleanup_and_exit 1
+    fi
+  fi
+
   determine_needed_tests
 
   prepopulate_footer
@@ -3153,10 +3203,29 @@ function import_core
   done
 }
 
+## @description setup the parameter tracker for param errors
+## @audience    private
+## @stability   evolving
+function setup_parameter_tracker
+{
+  declare i
+
+  for i in "${USER_PARAMS[@]}"; do
+    if [[ "${i}" =~ ^-- ]]; then
+      i=${i%=*}
+      PARAMETER_TRACKER+=("${i}")
+    fi
+  done
+}
+
 ###############################################################################
 ###############################################################################
 ###############################################################################
 
+# robots will change USER_PARAMS so must
+# do this before importing other code
+setup_parameter_tracker
+
 import_core
 
 if [[ "${BINNAME}" =~ qbt ]]; then


Mime
View raw message