Skip to content

Commit

Permalink
YETUS-1223. fix array usage in precommit (#304)
Browse files Browse the repository at this point in the history
  • Loading branch information
aw-was-here committed May 22, 2023
1 parent 38dc83d commit b83d268
Show file tree
Hide file tree
Showing 12 changed files with 113 additions and 113 deletions.
4 changes: 2 additions & 2 deletions precommit/src/main/shell/core.d/00-yetuslib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ function yetus_add_option
declare option=$1
declare text=$2

YETUS_OPTION_USAGE[${YETUS_OPTION_USAGE_COUNTER}]="${option}@${text}"
YETUS_OPTION_USAGE[YETUS_OPTION_USAGE_COUNTER]="${option}@${text}"
((YETUS_OPTION_USAGE_COUNTER=YETUS_OPTION_USAGE_COUNTER+1))
}

Expand Down Expand Up @@ -191,7 +191,7 @@ function yetus_generic_columnprinter
fi

while read -r line; do
tmpa[${counter}]=${line}
tmpa[counter]=${line}
((counter=counter+1))
option="${line%%@*}"
if [[ ${#option} -gt ${maxoptsize} ]]; then
Expand Down
10 changes: 5 additions & 5 deletions precommit/src/main/shell/core.d/builtin-bugsystem.sh
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,15 @@ function console_finalreport
seccoladj=$((seccoladj + 2 ))
i=0
until [[ $i -ge ${#TP_HEADER[@]} ]]; do
printf '%s\n' "${TP_HEADER[${i}]}"
printf '%s\n' "${TP_HEADER[i]}"
((i=i+1))
done

printf '| %s | %*s | %s | %s\n' "Vote" ${seccoladj} Subsystem Runtime "Comment"
echo "============================================================================"
i=0
until [[ $i -ge ${#TP_VOTE_TABLE[@]} ]]; do
ourstring=$(echo "${TP_VOTE_TABLE[${i}]}" | tr -s ' ')
ourstring=$(echo "${TP_VOTE_TABLE[i]}" | tr -s ' ')
vote=$(echo "${ourstring}" | cut -f2 -d\|)
subs=$(echo "${ourstring}" | cut -f3 -d\|)
ela=$(echo "${ourstring}" | cut -f4 -d\|)
Expand Down Expand Up @@ -145,7 +145,7 @@ function console_finalreport
printf '\n\n%*s | Tests\n' "${seccoladj}" "Reason"
i=0
until [[ $i -ge ${#TP_TEST_TABLE[@]} ]]; do
ourstring=$(echo "${TP_TEST_TABLE[${i}]}" | tr -s ' ')
ourstring=$(echo "${TP_TEST_TABLE[i]}" | tr -s ' ')
vote=$(echo "${ourstring}" | cut -f2 -d\|)
subs=$(echo "${ourstring}" | cut -f3 -d\|)
printf '%*s | %s\n' "${seccoladj}" "${vote}" "${subs}"
Expand All @@ -167,7 +167,7 @@ function console_finalreport

i=0
until [[ $i -ge ${#TP_VOTE_TABLE[@]} ]]; do
ourstring=$(echo "${TP_VOTE_TABLE[${i}]}" | tr -s ' ')
ourstring=$(echo "${TP_VOTE_TABLE[i]}" | tr -s ' ')
vote=$(echo "${ourstring}" | cut -f2 -d\|)
subs=$(echo "${ourstring}" | cut -f3 -d\|)
logfile=$(echo "${ourstring}" | cut -f5 -d\| | tr -d ' ')
Expand All @@ -186,7 +186,7 @@ function console_finalreport

i=0
until [[ $i -ge ${#TP_FOOTER_TABLE[@]} ]]; do
comment=$(echo "${TP_FOOTER_TABLE[${i}]}" | "${SED}" -e "s,@@BASE@@,${url},g")
comment=$(echo "${TP_FOOTER_TABLE[i]}" | "${SED}" -e "s,@@BASE@@,${url},g")
printf '%s\n' "${comment}"
((i=i+1))
done
Expand Down
6 changes: 3 additions & 3 deletions precommit/src/main/shell/plugins.d/briefreport.sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ function briefreport_finalreport

i=0
until [[ $i -ge ${#TP_VOTE_TABLE[@]} ]]; do
ourstring=$(echo "${TP_VOTE_TABLE[${i}]}" | tr -s ' ')
ourstring=$(echo "${TP_VOTE_TABLE[i]}" | tr -s ' ')
vote=$(echo "${ourstring}" | cut -f2 -d\|)
subs=$(echo "${ourstring}" | cut -f3 -d\|)
ela=$(echo "${ourstring}" | cut -f4 -d\|)
Expand Down Expand Up @@ -199,7 +199,7 @@ function briefreport_finalreport

i=0
until [[ $i -gt ${#TP_TEST_TABLE[@]} ]]; do
ourstring=$(echo "${TP_TEST_TABLE[${i}]}" | tr -s ' ')
ourstring=$(echo "${TP_TEST_TABLE[i]}" | tr -s ' ')
vote=$(echo "${ourstring}" | cut -f2 -d\|)
subs=$(echo "${ourstring}" | cut -f3 -d\|)
{
Expand All @@ -225,7 +225,7 @@ function briefreport_finalreport

i=0
until [[ $i -ge ${#TP_VOTE_TABLE[@]} ]]; do
ourstring=$(echo "${TP_VOTE_TABLE[${i}]}" | tr -s ' ')
ourstring=$(echo "${TP_VOTE_TABLE[i]}" | tr -s ' ')
subs=$(echo "${ourstring}" | cut -f3 -d\|)
logfile=$(echo "${ourstring}" | cut -f5 -d\| | tr -d ' ')

Expand Down
14 changes: 7 additions & 7 deletions precommit/src/main/shell/plugins.d/checkstyle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ function checkstyle_runner

# start the clock per module, setup some help vars, etc
start_clock
fn=$(module_file_fragment "${MODULE[${i}]}")
modulesuffix=$(basename "${MODULE[${i}]}")
fn=$(module_file_fragment "${MODULE[i]}")
modulesuffix=$(basename "${MODULE[i]}")
output="${PATCH_DIR}/${repostatus}-checkstyle-${fn}.txt"
logfile="${PATCH_DIR}/buildtool-${repostatus}-checkstyle-${fn}.txt"

Expand All @@ -190,19 +190,19 @@ function checkstyle_runner
ant)
cmd="${ANT} \
-Dcheckstyle.consoleOutput=true \
${MODULEEXTRAPARAM[${i}]//@@@MODULEFN@@@/${fn}} \
${MODULEEXTRAPARAM[i]//@@@MODULEFN@@@/${fn}} \
${ANT_ARGS[*]} checkstyle"
;;
maven)
cmd="${MAVEN} ${MAVEN_ARGS[*]} \
checkstyle:${CHECKSTYLE_GOAL} \
${CHECKSTYLE_OPTIONS} \
${MODULEEXTRAPARAM[${i}]//@@@MODULEFN@@@/${fn}} -Ptest-patch"
${MODULEEXTRAPARAM[i]//@@@MODULEFN@@@/${fn}} -Ptest-patch"
;;
gradle)
cmd="${GRADLEW} ${GRADLEW_ARGS[*]} \
checkstyleMain checkstyleTest \
${MODULEEXTRAPARAM[${i}]//@@@MODULEFN@@@/${fn}}"
${MODULEEXTRAPARAM[i]//@@@MODULEFN@@@/${fn}}"
;;
*)
UNSUPPORTED_TEST=true
Expand Down Expand Up @@ -334,7 +334,7 @@ function checkstyle_runner

savestop=$(stop_clock)
#shellcheck disable=SC2034
MODULE_STATUS_TIMER[${i}]=${savestop}
MODULE_STATUS_TIMER[i]=${savestop}

popd >/dev/null || return 1
((i=i+1))
Expand Down Expand Up @@ -418,7 +418,7 @@ personality_modules_wrapper patch checkstyle
offset_clock "${CHECKSTYLE_TIMER}"

until [[ $i -eq ${#MODULE[@]} ]]; do
if [[ ${MODULE_STATUS[${i}]} == -1 ]]; then
if [[ ${MODULE_STATUS[i]} == -1 ]]; then
((result=result+1))
((i=i+1))
continue
Expand Down
12 changes: 6 additions & 6 deletions precommit/src/main/shell/plugins.d/github.sh
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,7 @@ function github_finalreport_as_comment

i=0
until [[ ${i} -ge ${#TP_HEADER[@]} ]]; do
printf '%s\n\n' "${TP_HEADER[${i}]}" >> "${commentfile}"
printf '%s\n\n' "${TP_HEADER[i]}" >> "${commentfile}"
((i=i+1))
done

Expand All @@ -864,7 +864,7 @@ function github_finalreport_as_comment

i=0
until [[ ${i} -ge ${#TP_VOTE_TABLE[@]} ]]; do
ourstring=$(echo "${TP_VOTE_TABLE[${i}]}" | tr -s ' ')
ourstring=$(echo "${TP_VOTE_TABLE[i]}" | tr -s ' ')
vote=$(echo "${ourstring}" | cut -f2 -d\| | tr -d ' ')
subs=$(echo "${ourstring}" | cut -f3 -d\|)
ela=$(echo "${ourstring}" | cut -f4 -d\|)
Expand Down Expand Up @@ -933,7 +933,7 @@ function github_finalreport_as_comment
} >> "${commentfile}"
i=0
until [[ ${i} -ge ${#TP_TEST_TABLE[@]} ]]; do
echo "${TP_TEST_TABLE[${i}]}" >> "${commentfile}"
echo "${TP_TEST_TABLE[i]}" >> "${commentfile}"
((i=i+1))
done
fi
Expand All @@ -946,7 +946,7 @@ function github_finalreport_as_comment

i=0
until [[ $i -ge ${#TP_FOOTER_TABLE[@]} ]]; do
comment=$(echo "${TP_FOOTER_TABLE[${i}]}" | "${SED}" -e "s,@@BASE@@,${url},g")
comment=$(echo "${TP_FOOTER_TABLE[i]}" | "${SED}" -e "s,@@BASE@@,${url},g")
printf '%s\n' "${comment}" >> "${commentfile}"
((i=i+1))
done
Expand Down Expand Up @@ -1126,7 +1126,7 @@ function github_finalreport
if [[ "${result}" == 0 ]]; then
i=0
until [[ ${i} -eq ${#TP_VOTE_TABLE[@]} ]]; do
ourstring=$(echo "${TP_VOTE_TABLE[${i}]}" | tr -s ' ')
ourstring=$(echo "${TP_VOTE_TABLE[i]}" | tr -s ' ')
vote=$(echo "${ourstring}" | cut -f2 -d\| | tr -d ' ')

if [[ "${vote}" == "-0" ]]; then
Expand Down Expand Up @@ -1182,7 +1182,7 @@ function github_finalreport
url=$(get_artifact_url)
i=0
until [[ ${i} -eq ${#TP_VOTE_TABLE[@]} ]]; do
ourstring=$(echo "${TP_VOTE_TABLE[${i}]}" | tr -s ' ')
ourstring=$(echo "${TP_VOTE_TABLE[i]}" | tr -s ' ')
vote=$(echo "${ourstring}" | cut -f2 -d\| | tr -d ' ')
subs=$(echo "${ourstring}" | cut -f3 -d\|)
logfile=$(echo "${ourstring}" | cut -f5 -d\| | tr -d ' ')
Expand Down
8 changes: 4 additions & 4 deletions precommit/src/main/shell/plugins.d/gitlab.sh
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ function gitlab_finalreport

i=0
until [[ ${i} -ge ${#TP_HEADER[@]} ]]; do
printf "%s\\n\\n" "${TP_HEADER[${i}]}" >> "${commentfile}"
printf "%s\\n\\n" "${TP_HEADER[i]}" >> "${commentfile}"
((i=i+1))
done

Expand All @@ -460,7 +460,7 @@ function gitlab_finalreport

i=0
until [[ ${i} -ge ${#TP_VOTE_TABLE[@]} ]]; do
ourstring=$(echo "${TP_VOTE_TABLE[${i}]}" | tr -s ' ')
ourstring=$(echo "${TP_VOTE_TABLE[i]}" | tr -s ' ')
vote=$(echo "${ourstring}" | cut -f2 -d\| | tr -d ' ')
subs=$(echo "${ourstring}" | cut -f3 -d\|)
ela=$(echo "${ourstring}" | cut -f4 -d\|)
Expand Down Expand Up @@ -529,7 +529,7 @@ function gitlab_finalreport
} >> "${commentfile}"
i=0
until [[ ${i} -ge ${#TP_TEST_TABLE[@]} ]]; do
echo "${TP_TEST_TABLE[${i}]}" >> "${commentfile}"
echo "${TP_TEST_TABLE[i]}" >> "${commentfile}"
((i=i+1))
done
fi
Expand All @@ -543,7 +543,7 @@ function gitlab_finalreport

i=0
until [[ $i -ge ${#TP_FOOTER_TABLE[@]} ]]; do
comment=$(echo "${TP_FOOTER_TABLE[${i}]}" | "${SED}" -e "s,@@BASE@@,${url},g")
comment=$(echo "${TP_FOOTER_TABLE[i]}" | "${SED}" -e "s,@@BASE@@,${url},g")
printf '%s\n' "${comment}" >> "${commentfile}"
((i=i+1))
done
Expand Down
8 changes: 4 additions & 4 deletions precommit/src/main/shell/plugins.d/htmlout.sh
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ function htmlout_report_writer

i=0
until [[ $i -ge ${#TP_HEADER[@]} ]]; do
ourstring=$(echo "${TP_HEADER[${i}]}" | tr -s ' ')
ourstring=$(echo "${TP_HEADER[i]}" | tr -s ' ')
comment=$(echo "${ourstring}" | cut -f2 -d\|)
printf '<tr><td>%s</td></tr>\n' "${comment}"
((i=i+1))
Expand All @@ -145,7 +145,7 @@ function htmlout_report_writer

i=0
until [[ $i -ge ${#TP_VOTE_TABLE[@]} ]]; do
ourstring=$(echo "${TP_VOTE_TABLE[${i}]}" | tr -s ' ')
ourstring=$(echo "${TP_VOTE_TABLE[i]}" | tr -s ' ')
vote=$(echo "${ourstring}" | cut -f2 -d\| | tr -d ' ')
subs=$(echo "${ourstring}" | cut -f3 -d\|)
ela=$(echo "${ourstring}" | cut -f4 -d\|)
Expand Down Expand Up @@ -227,7 +227,7 @@ function htmlout_report_writer

i=0
until [[ $i -ge ${#TP_TEST_TABLE[@]} ]]; do
ourstring=$(echo "${TP_TEST_TABLE[${i}]}" | tr -s ' ')
ourstring=$(echo "${TP_TEST_TABLE[i]}" | tr -s ' ')
subs=$(echo "${ourstring}" | cut -f2 -d\|)
comment=$(echo "${ourstring}" | cut -f3 -d\|)
{
Expand Down Expand Up @@ -265,7 +265,7 @@ function htmlout_report_writer
# excess spaces
set -f
ourstring=""
for j in ${TP_FOOTER_TABLE[${i}]}; do
for j in ${TP_FOOTER_TABLE[i]}; do
if [[ "${j}" =~ ^@@BASE@@ ]]; then
t1=${j#@@BASE@@/}
t2=$(echo "${j}" | "${SED}" -e "s,@@BASE@@,${url},g")
Expand Down
8 changes: 4 additions & 4 deletions precommit/src/main/shell/plugins.d/jira.sh
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ function jira_finalreport

i=0
until [[ $i -ge ${#TP_HEADER[@]} ]]; do
printf '%s\n' "${TP_HEADER[${i}]}" >> "${commentfile}"
printf '%s\n' "${TP_HEADER[i]}" >> "${commentfile}"
((i=i+1))
done

Expand All @@ -457,7 +457,7 @@ function jira_finalreport

i=0
until [[ $i -ge ${#TP_VOTE_TABLE[@]} ]]; do
ourstring=$(echo "${TP_VOTE_TABLE[${i}]}" | tr -s ' ')
ourstring=$(echo "${TP_VOTE_TABLE[i]}" | tr -s ' ')
vote=$(echo "${ourstring}" | cut -f2 -d\| | tr -d ' ')
subs=$(echo "${ourstring}" | cut -f3 -d\|)
ela=$(echo "${ourstring}" | cut -f4 -d\|)
Expand Down Expand Up @@ -527,7 +527,7 @@ function jira_finalreport
echo "|| Reason || Tests ||" >> "${commentfile}"
i=0
until [[ $i -ge ${#TP_TEST_TABLE[@]} ]]; do
printf '%s\n' "${TP_TEST_TABLE[${i}]}" >> "${commentfile}"
printf '%s\n' "${TP_TEST_TABLE[i]}" >> "${commentfile}"
((i=i+1))
done
fi
Expand All @@ -538,7 +538,7 @@ function jira_finalreport
echo "|| Subsystem || Report/Notes ||" >> "${commentfile}"
i=0
until [[ $i -ge ${#TP_FOOTER_TABLE[@]} ]]; do
comment=$(echo "${TP_FOOTER_TABLE[${i}]}" | "${SED}" -e "s,@@BASE@@,${url},g")
comment=$(echo "${TP_FOOTER_TABLE[i]}" | "${SED}" -e "s,@@BASE@@,${url},g")
printf '%s\n' "${comment}" >> "${commentfile}"
((i=i+1))
done
Expand Down
2 changes: 1 addition & 1 deletion precommit/src/main/shell/plugins.d/junit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ EOF

i=0
until [[ $i -ge ${#TP_VOTE_TABLE[@]} ]]; do
ourstring=$(echo "${TP_VOTE_TABLE[${i}]}" | tr -s ' ')
ourstring=$(echo "${TP_VOTE_TABLE[i]}" | tr -s ' ')
vote=$(echo "${ourstring}" | cut -f2 -d\|)
subs=$(echo "${ourstring}" | cut -f3 -d\|)
ela=$(echo "${ourstring}" | cut -f4 -d\|)
Expand Down
Loading

0 comments on commit b83d268

Please sign in to comment.