Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions precommit/src/main/shell/core.d/00-yetuslib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ function yetus_generic_columnprinter
while read -r line; do
tmpa[${counter}]=${line}
((counter=counter+1))
option=$(echo "${line}" | cut -f1 -d'@')
option="${line%%@*}"
if [[ ${#option} -gt ${maxoptsize} ]]; then
maxoptsize=${#option}
fi
Expand All @@ -205,8 +205,8 @@ function yetus_generic_columnprinter
((foldsize=numcols-maxoptsize))

until [[ $i -eq ${#tmpa[@]} ]]; do
option=$(echo "${tmpa[$i]}" | cut -f1 -d'@')
giventext=$(echo "${tmpa[$i]}" | cut -f2 -d'@')
option="${tmpa[$i]%%@*}"
giventext="${tmpa[$i]##*@}"

while read -r line; do
printf "%-${maxoptsize}s %-s\\n" "${option}" "${line}"
Expand Down Expand Up @@ -405,7 +405,7 @@ function yetus_sort_array
declare oifs
declare -a sa

globstatus=$(set -o | grep noglob | awk '{print $NF}')
globstatus=$(set -o | awk '/noglob/ {print $NF}')

if [[ -n ${IFS} ]]; then
oifs=${IFS}
Expand Down Expand Up @@ -442,7 +442,7 @@ function yetus_sort_and_unique_array
declare oifs
declare -a sa

globstatus=$(set -o | grep noglob | awk '{print $NF}')
globstatus=$(set -o | awk '/noglob/ {print $NF}')

if [[ -n ${IFS} ]]; then
oifs=${IFS}
Expand Down
13 changes: 7 additions & 6 deletions precommit/src/main/shell/core.d/01-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -729,9 +729,9 @@ function set_yetus_version
VERSION=$(cat "${BINDIR}/VERSION")
elif [[ -f "${BINDIR}/../../../pom.xml" ]]; then
# this way we have no dependency on Maven being installed
VERSION=$(${GREP} "<version>" "${BINDIR}/../../../pom.xml" 2>/dev/null \
VERSION=$("${GREP}" "<version>" "${BINDIR}/../../../pom.xml" 2>/dev/null \
| head -1 \
| ${SED} -e 's|^ *<version>||' -e 's|</version>.*$||' 2>/dev/null)
| "${SED}" -e 's|^ *<version>||' -e 's|</version>.*$||' 2>/dev/null)
fi
}

Expand Down Expand Up @@ -804,12 +804,13 @@ function guess_build_tool
## @param module
function module_file_fragment
{
local mod=$1
if [[ ${mod} = \. ]]; then
declare mod

if [[ ${1} = \. ]]; then
echo root
else
#shellcheck disable=SC1003
echo "$1" | tr '/' '_' | tr '\\' '_'
mod=${1//\//_}
echo "${mod//\\/_}"
fi
}

Expand Down
26 changes: 16 additions & 10 deletions precommit/src/main/shell/test-patch.d/checkstyle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ function checkstyle_runner
declare codeline
declare cmdresult
declare -a filelist
declare rol

# first, let's clear out any previous run information
modules_reset
Expand Down Expand Up @@ -306,13 +307,14 @@ function checkstyle_runner

# file:linenum:(column:)error ====>
# file:linenum:code(:column)\x01:error
# \x01 will later used to identify the begining
# \x01 will later used to identify the beginning
# of the checkstyle error message
pushd "${BASEDIR}" >/dev/null || return 1
while read -r logline; do
file=$(echo "${logline}" | cut -f1 -d:)
linenum=$(echo "${logline}" | cut -f2 -d:)
text=$(echo "${logline}" | cut -f3- -d:)
file=${logline%%:*}
rol=${logline/#${file}:}
linenum=${rol%%:*}
text=${rol/#${linenum}:}
codeline=$(head -n "+${linenum}" "${file}" | tail -1 )
{
echo -n "${file}:${linenum}:${codeline}"
Expand Down Expand Up @@ -393,6 +395,7 @@ function checkstyle_postapply
declare numpatch=0
declare addpatch=0
declare summarize=true
declare tmpvar

if ! verify_needed_test checkstyle; then
return 0
Expand Down Expand Up @@ -439,12 +442,15 @@ function checkstyle_postapply
> "${PATCH_DIR}/diff-checkstyle-${fn}.txt"
fi

#shellcheck disable=SC2016
numbranch=$(wc -l "${PATCH_DIR}/branch-checkstyle-${fn}.txt" | ${AWK} '{print $1}')
#shellcheck disable=SC2016
numpatch=$(wc -l "${PATCH_DIR}/patch-checkstyle-${fn}.txt" | ${AWK} '{print $1}')
#shellcheck disable=SC2016
addpatch=$(wc -l "${PATCH_DIR}/diff-checkstyle-${fn}.txt" | ${AWK} '{print $1}')
tmpvar=$(wc -l "${PATCH_DIR}/branch-checkstyle-${fn}.txt")
numbranch=${tmpvar%% *}

tmpvar=$(wc -l "${PATCH_DIR}/patch-checkstyle-${fn}.txt")
numpatch=${tmpvar%% *}

tmpvar=$(wc -l "${PATCH_DIR}/diff-checkstyle-${fn}.txt")
addpatch=${tmpvar%% *}


((fixedpatch=numbranch-numpatch+addpatch))

Expand Down
8 changes: 4 additions & 4 deletions precommit/src/main/shell/test-patch.d/whitespace.sh
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ function whitespace_postcompile
;;
esac

# shellcheck disable=SC2016
count=$(wc -l "${PATCH_DIR}/whitespace-eol.txt" | ${AWK} '{print $1}')
temp1=$(wc -l "${PATCH_DIR}/whitespace-eol.txt")
count=${temp1%% *}

if [[ ${count} -gt 0 ]]; then
if [[ "${BUILDMODE}" = full ]]; then
Expand All @@ -159,8 +159,8 @@ function whitespace_postcompile
((result=result+1))
fi

# shellcheck disable=SC2016
count=$(wc -l "${PATCH_DIR}/whitespace-tabs.txt" | ${AWK} '{print $1}')
temp1=$(wc -l "${PATCH_DIR}/whitespace-tabs.txt")
count=${temp1%% *}

if [[ ${count} -gt 0 ]]; then
add_vote_table_v2 -1 whitespace \
Expand Down
42 changes: 26 additions & 16 deletions precommit/src/main/shell/test-patch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2185,24 +2185,29 @@ function bugsystem_linecomments_queue
declare text
declare columncheck
declare column
declare rol
declare file

if [[ -z "${BUGLINECOMMENTS}" ]]; then
return 0
fi

while read -r line; do
file=$(echo "${line}" | cut -f1 -d:)
file=${line%%:*}
rol=${line/#${file}:}
if [[ "${file}" =~ ^\./ ]]; then
file=${file:2}
fi
linenum=$(echo "${line}" | cut -f2 -d:)
columncheck=$(echo "${line}" | cut -f3 -d:)

linenum=${rol%%:*}
rol=${rol/#${linenum}:}
columncheck=${rol%%:*}
if [[ "${columncheck}" =~ ^[0-9]+$ ]]; then
column=${columncheck}
text=$(echo "${line}" | cut -f4- -d:)
text=${rol/#${column}:}
else
column="0"
text=$(echo "${line}" | cut -f3- -d:)
text=${rol}
fi

echo "${file}:${linenum}:${column}:${plugin}:${text}" >> "${PATCH_DIR}/linecomments-in.txt"
Expand Down Expand Up @@ -2231,11 +2236,14 @@ function bugsystem_linecomments_trigger
sort -k1,1 -k2,2n -k3,3n -k4,4 "${PATCH_DIR}/linecomments-in.txt" > "${PATCH_DIR}/linecomments-sorted.txt"

while read -r line;do
fn=$(echo "${line}" | cut -f1 -d:)
linenum=$(echo "${line}" | cut -f2 -d:)
column=$(echo "${line}" | cut -f3 -d:)
plugin=$(echo "${line}" | cut -f4 -d:)
text=$(echo "${line}" | cut -f5- -d:)
fn=${line%%:*}
rol=${line/#${fn}:}
linenum=${rol%%:*}
rol=${rol/#${linenum}:}
column=${rol%%:*}
rol=${rol/#${column}:}
plugin=${rol%%:*}
text=${rol/#${plugin}:}

for bugs in ${BUGLINECOMMENTS}; do
if declare -f "${bugs}_linecomments" >/dev/null;then
Expand Down Expand Up @@ -2637,6 +2645,8 @@ function module_postlog_compare
declare -i samepatch=0
declare -i fixedpatch=0
declare summarize=true
declare tmpvar


if [[ ${multijdk} == true ]]; then
jdk=$(report_jvm_version "${JAVA_HOME}")
Expand Down Expand Up @@ -2674,19 +2684,19 @@ function module_postlog_compare
generic_logfilter "${testtype}" "${PATCH_DIR}/branch-${origlog}-${fn}.txt" "${PATCH_DIR}/branch-${origlog}-${testtype}-${fn}.txt"
generic_logfilter "${testtype}" "${PATCH_DIR}/patch-${origlog}-${fn}.txt" "${PATCH_DIR}/patch-${origlog}-${testtype}-${fn}.txt"

# shellcheck disable=SC2016
numbranch=$(wc -l "${PATCH_DIR}/branch-${origlog}-${testtype}-${fn}.txt" | "${AWK}" '{print $1}')
# shellcheck disable=SC2016
numpatch=$(wc -l "${PATCH_DIR}/patch-${origlog}-${testtype}-${fn}.txt" | "${AWK}" '{print $1}')
tmpvar=$(wc -l "${PATCH_DIR}/branch-${origlog}-${testtype}-${fn}.txt")
numbranch=${tmpvar%% *}
tmpvar=$(wc -l "${PATCH_DIR}/patch-${origlog}-${testtype}-${fn}.txt")
numpatch=${tmpvar%% *}

calcdiffs \
"${PATCH_DIR}/branch-${origlog}-${testtype}-${fn}.txt" \
"${PATCH_DIR}/patch-${origlog}-${testtype}-${fn}.txt" \
"${testtype}" \
> "${PATCH_DIR}/diff-${origlog}-${testtype}-${fn}.txt"

# shellcheck disable=SC2016
addpatch=$(wc -l "${PATCH_DIR}/diff-${origlog}-${testtype}-${fn}.txt" | "${AWK}" '{print $1}')
tmpvar=$(wc -l "${PATCH_DIR}/diff-${origlog}-${testtype}-${fn}.txt")
addpatch=${tmpvar%% *}

((fixedpatch=numbranch-numpatch+addpatch))

Expand Down