You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@yetus.apache.org by aw...@apache.org on 2020/10/19 04:29:30 UTC
[yetus] branch main updated: YETUS-1028. Various missing github
annotations (#162)
This is an automated email from the ASF dual-hosted git repository.
aw pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/yetus.git
The following commit(s) were added to refs/heads/main by this push:
new 5e346ee YETUS-1028. Various missing github annotations (#162)
5e346ee is described below
commit 5e346eee7da9a71caaaaba0451239c7c23b541b4
Author: Allen Wittenauer <aw...@apache.org>
AuthorDate: Sun Oct 18 21:29:19 2020 -0700
YETUS-1028. Various missing github annotations (#162)
* Added group control to github actions output to make it
easier to debug
* Changed the remaining diff- to results-
* Reformatted asflicense output, now calls b_l_queue
* Reformatted author output (where possible), now calls b_l_queue
* Reformatted dupname output, now calls b_l_queue
* Reformatted maven javac output, now uses column_calcdiffs
* Reformatted maven javadoc output, now users error_calcdiffs
* Reformatted pathlen output, now calls b_l_queue
* Reformatted unitveto output, now cals b_l_queue
* b_l_queue rejects plug-ins that are in the tests filter
* b_l_queue verifies that the first column exists
* modules_messages now calls b_l_queue
There are likely other plug-ins that will need massaging
(esp ant and gradle), but this covers a good chunk of missing
functionality for the most users.
---
precommit/src/main/shell/robots.d/githubactions.sh | 7 ++
.../src/main/shell/test-patch.d/asflicense.sh | 17 +++--
precommit/src/main/shell/test-patch.d/author.sh | 13 ++--
.../src/main/shell/test-patch.d/checkstyle.sh | 10 +--
precommit/src/main/shell/test-patch.d/dupname.sh | 12 ++--
precommit/src/main/shell/test-patch.d/maven.sh | 76 ++++++----------------
precommit/src/main/shell/test-patch.d/pathlen.sh | 5 +-
precommit/src/main/shell/test-patch.d/unitveto.sh | 6 +-
precommit/src/main/shell/test-patch.sh | 36 +++++++---
9 files changed, 92 insertions(+), 90 deletions(-)
diff --git a/precommit/src/main/shell/robots.d/githubactions.sh b/precommit/src/main/shell/robots.d/githubactions.sh
index eab4875..970d836 100755
--- a/precommit/src/main/shell/robots.d/githubactions.sh
+++ b/precommit/src/main/shell/robots.d/githubactions.sh
@@ -18,6 +18,9 @@
if [[ "${GITHUB_ACTIONS}" == true ]] &&
declare -f compile_cycle >/dev/null; then
+
+ echo "::group::Bootstrap"
+
# shellcheck disable=SC2034
ROBOT=true
# shellcheck disable=SC2034
@@ -79,3 +82,7 @@ function githubactions_set_plugin_defaults
GITHUB_REPO="${GITHUB_REPOSITORY}"
}
+function githubactions_cleanup_and_exit
+{
+ echo "::endgroup::"
+}
\ No newline at end of file
diff --git a/precommit/src/main/shell/test-patch.d/asflicense.sh b/precommit/src/main/shell/test-patch.d/asflicense.sh
index 2e10095..5b17549 100755
--- a/precommit/src/main/shell/test-patch.d/asflicense.sh
+++ b/precommit/src/main/shell/test-patch.d/asflicense.sh
@@ -143,17 +143,16 @@ function asflicense_tests
echo "There appear to be ${numpatch} ASF License warnings after applying the patch."
if [[ -n ${numpatch}
&& ${numpatch} -gt 0 ]] ; then
+
+ # shellcheck disable=SC2016
+ "${GREP}" '\!?????' "${PATCH_DIR}/patch-asflicense.txt" \
+ | "${SED}" -e "s,${BASEDIR},,g" -e "s, \!????? ,,g" \
+ | "${AWK}" '{print $1":1:Missing Apache License"}' \
+ >> "${PATCH_DIR}/results-asflicense.txt"
add_vote_table_v2 -1 asflicense \
- "@@BASE@@/patch-asflicense-problems.txt" \
+ "@@BASE@@/results-asflicense.txt" \
"${BUILDMODEMSG} generated ${numpatch} ASF License warnings."
-
- echo "Lines that start with ????? in the ASF License "\
- "report indicate files that do not have an Apache license header:" \
- > "${PATCH_DIR}/patch-asflicense-problems.txt"
-
- ${GREP} '\!?????' "${PATCH_DIR}/patch-asflicense.txt" \
- >> "${PATCH_DIR}/patch-asflicense-problems.txt"
-
+ bugsystem_linecomments_queue asflicense "${PATCH_DIR}/results-asflicense.txt"
return 1
fi
add_vote_table_v2 1 asflicense "" "${BUILDMODEMSG} does not generate ASF License warnings."
diff --git a/precommit/src/main/shell/test-patch.d/author.sh b/precommit/src/main/shell/test-patch.d/author.sh
index fb01fb8..2e9ea37 100755
--- a/precommit/src/main/shell/test-patch.d/author.sh
+++ b/precommit/src/main/shell/test-patch.d/author.sh
@@ -16,6 +16,8 @@
add_test_type author
+AUTHOR_LOGNAME="results-author.txt"
+
## @description author usage hook
## @audience private
## @stability evolving
@@ -62,13 +64,14 @@ function author_generic
fi
# shellcheck disable=SC2016
- authortags=$(wc -l "${PATCH_DIR}/author-tags.txt" | "${AWK}" '{print $1}')
+ authortags=$(wc -l "${PATCH_DIR}/${AUTHOR_LOGNAME}" | "${AWK}" '{print $1}')
echo "There appear to be ${authortags} @author tags in the ${msg}."
if [[ ${authortags} != 0 ]] ; then
add_vote_table_v2 -1 @author \
- "@@BASE@@/author-tags.txt" \
+ "@@BASE@@/${AUTHOR_LOGNAME}" \
"${BUILDMODEMSG} appears to contain ${authortags} @author tags which the" \
" community has agreed to not allow in code contributions."
+ bugsystem_linecomments_queue author "${PATCH_DIR}/${AUTHOR_LOGNAME}"
return 1
fi
add_vote_table_v2 +1 @author "" "${BUILDMODEMSG} does not contain any @author tags."
@@ -105,7 +108,7 @@ function author_patchfile
fi
done
- "${GREP}" -i -n '^[^-].*@author' "${patchfile}" >> "${PATCH_DIR}/author-tags.txt"
+ "${GREP}" -i -n '^[^-].*@author' "${patchfile}" >> "${PATCH_DIR}/${AUTHOR_LOGNAME}"
author_generic
}
@@ -142,13 +145,13 @@ function author_postcompile
>> "${PATCH_DIR}/author-tags-git.txt"
if [[ -z "${AUTHOR_IGNORE_LIST[0]}" ]]; then
- cp -p "${PATCH_DIR}/author-tags-git.txt" "${PATCH_DIR}/author-tags.txt"
+ cp -p "${PATCH_DIR}/author-tags-git.txt" "${PATCH_DIR}/${AUTHOR_LOGNAME}"
else
printf "^%s\n" "${AUTHOR_IGNORE_LIST[@]}" > "${PATCH_DIR}/author-tags-filter.txt"
"${GREP}" -v -E \
-f "${PATCH_DIR}/author-tags-filter.txt" \
"${PATCH_DIR}/author-tags-git.txt" \
- > "${PATCH_DIR}/author-tags.txt"
+ > "${PATCH_DIR}/${AUTHOR_LOGNAME}"
fi
author_generic
diff --git a/precommit/src/main/shell/test-patch.d/checkstyle.sh b/precommit/src/main/shell/test-patch.d/checkstyle.sh
index 9d4339a..7c656b8 100755
--- a/precommit/src/main/shell/test-patch.d/checkstyle.sh
+++ b/precommit/src/main/shell/test-patch.d/checkstyle.sh
@@ -431,7 +431,7 @@ function checkstyle_postapply
if [[ "${BUILDMODE}" = full ]]; then
touch "${PATCH_DIR}/branch-checkstyle-${fn}.txt"
cp -p "${PATCH_DIR}/patch-checkstyle-${fn}.txt" \
- "${PATCH_DIR}/diff-checkstyle-${fn}.txt"
+ "${PATCH_DIR}/results-checkstyle-${fn}.txt"
else
# call calcdiffs to allow overrides
@@ -439,7 +439,7 @@ function checkstyle_postapply
"${PATCH_DIR}/branch-checkstyle-${fn}.txt" \
"${PATCH_DIR}/patch-checkstyle-${fn}.txt" \
checkstyle \
- > "${PATCH_DIR}/diff-checkstyle-${fn}.txt"
+ > "${PATCH_DIR}/results-checkstyle-${fn}.txt"
fi
tmpvar=$(wc -l "${PATCH_DIR}/branch-checkstyle-${fn}.txt")
@@ -448,7 +448,7 @@ function checkstyle_postapply
tmpvar=$(wc -l "${PATCH_DIR}/patch-checkstyle-${fn}.txt")
numpatch=${tmpvar%% *}
- tmpvar=$(wc -l "${PATCH_DIR}/diff-checkstyle-${fn}.txt")
+ tmpvar=$(wc -l "${PATCH_DIR}/results-checkstyle-${fn}.txt")
addpatch=${tmpvar%% *}
@@ -463,9 +463,9 @@ function checkstyle_postapply
if [[ ${addpatch} -gt 0 ]] ; then
((result = result + 1))
- module_status "${i}" -1 "diff-checkstyle-${fn}.txt" "${mod}: ${BUILDMODEMSG} ${statstring}"
+ module_status "${i}" -1 "results-checkstyle-${fn}.txt" "${mod}: ${BUILDMODEMSG} ${statstring}"
elif [[ ${fixedpatch} -gt 0 ]]; then
- module_status "${i}" +1 "diff-checkstyle-${fn}.txt" "${mod}: ${BUILDMODEMSG} ${statstring}"
+ module_status "${i}" +1 "results-checkstyle-${fn}.txt" "${mod}: ${BUILDMODEMSG} ${statstring}"
summarize=false
fi
((i=i+1))
diff --git a/precommit/src/main/shell/test-patch.d/dupname.sh b/precommit/src/main/shell/test-patch.d/dupname.sh
index 373ad48..db93791 100755
--- a/precommit/src/main/shell/test-patch.d/dupname.sh
+++ b/precommit/src/main/shell/test-patch.d/dupname.sh
@@ -82,7 +82,7 @@ function dupname_precheck
existing=$(${GIT} ls-files ":(icase)${fn}")
if [[ -n "${existing}" ]]; then
if [[ "${existing}" != "${fn}" ]]; then
- echo "patch:${fn} tree:${existing}" >> "${PATCH_DIR}/dupnames.txt"
+ echo "${fn}:1:patch ${fn} matches existing ${existing}" >> "${PATCH_DIR}/results-dupnames.txt"
((count=count + 1))
fi
fi
@@ -99,7 +99,7 @@ function dupname_precheck
if [[ "${cur}" != "${prev}" ]]; then
curlc=$(echo "${cur}" | tr '[:upper:]' '[:lower:]')
if [[ "${curlc}" == "${prevlc}" ]]; then
- echo "patch:${cur} patch:${prev}" >> "${PATCH_DIR}/dupnames.txt"
+ echo "${cur}:1:matches ${prev} in same patch file" >> "${PATCH_DIR}/results-dupnames.txt"
((count=count + 1))
fi
fi
@@ -111,15 +111,17 @@ function dupname_precheck
if [[ ${count} -gt 0 ]]; then
if [[ "${BUILDMODE}" != full ]]; then
- add_vote_table_v2 -1 dupname "@@BASE@@/dupnames.txt" \
+ add_vote_table_v2 -1 dupname "@@BASE@@/results-dupnames.txt" \
"The patch has ${count}" \
" duplicated filenames that differ only in case."
+ bugsystem_linecomments_queue dupname "${PATCH_DIR}/results-dupnames.txt"
yetus_error "ERROR: Won't apply the patch; may break the workspace."
return 1
else
- add_vote_table_v2 -1 dupname "@@BASE@@/dupnames.txt" \
- "Source has ${count}" \
+ add_vote_table_v2 -1 dupname "@@BASE@@/results-dupnames.txt" \
+ "Source has ${count}" \
" duplicated filenames that differ only in case."
+ bugsystem_linecomments_queue dupname "${PATCH_DIR}/results-dupnames.txt"
fi
else
add_vote_table_v2 +1 dupname "" "No case conflicting files found."
diff --git a/precommit/src/main/shell/test-patch.d/maven.sh b/precommit/src/main/shell/test-patch.d/maven.sh
index a09e79e..2fc11aa 100755
--- a/precommit/src/main/shell/test-patch.d/maven.sh
+++ b/precommit/src/main/shell/test-patch.d/maven.sh
@@ -382,7 +382,16 @@ function maven_javac_logfilter
declare input=$1
declare output=$2
- ${GREP} -E '\[(ERROR|WARNING)\] /.*\.java:' "${input}" > "${output}"
+ # [WARNING] fullpath:[linenum,column] message
+
+ "${GREP}" -E '\[(ERROR|WARNING)\] /.*\.java:' "${input}" \
+ | "${SED}" -E -e 's,\[(ERROR|WARNING)\] ,,' \
+ -e "s,^${BASEDIR}/,," \
+ -e "s#:\[([[:digit:]]+),([[:digit:]]+)\] #:\1:\2:#" \
+ -e "s#:\[([[:digit:]]+)\] #:\1:0:#" \
+ > "${output}"
+
+ # shortpath:linenum:column:message
}
## @description Helper for check_patch_javadoc
@@ -396,7 +405,15 @@ function maven_javadoc_logfilter
declare input=$1
declare output=$2
- ${GREP} -E '\[(ERROR|WARNING)\] /.*\.java:' "${input}" > "${output}"
+ # [WARNING] fullpath:linenum:message
+
+ "${GREP}" -E '\[(ERROR|WARNING)\] /.*\.java:' "${input}" \
+ | "${SED}" -E -e 's,\[(ERROR|WARNING)\] ,,g' \
+ -e "s,^${BASEDIR}/,," \
+ > "${output}"
+
+ # shortpath:linenum:message
+
}
## @description handle diffing maven javac errors
@@ -408,33 +425,7 @@ function maven_javadoc_logfilter
## @return differences
function maven_javac_calcdiffs
{
- declare orig=$1
- declare new=$2
- declare tmp=${PATCH_DIR}/pl.$$.${RANDOM}
-
- # first, strip :[line
- # this keeps file,column in an attempt to increase
- # accuracy in case of multiple, repeated errors
- # since the column number shouldn't change
- # if the line of code hasn't been touched
- "${SED}" -e 's#:\[[0-9]*,#:#' "${orig}" > "${tmp}.branch"
- "${SED}" -e 's#:\[[0-9]*,#:#' "${new}" > "${tmp}.patch"
-
- # compare the errors, generating a string of line
- # numbers. Sorry portability: GNU diff makes this too easy
- ${DIFF} --unchanged-line-format="" \
- --old-line-format="" \
- --new-line-format="%dn " \
- "${tmp}.branch" \
- "${tmp}.patch" > "${tmp}.lined"
-
- # now, pull out those lines of the raw output
- # shellcheck disable=SC2013
- for j in $(cat "${tmp}.lined"); do
- head -"${j}" "${new}" | tail -1
- done
-
- rm "${tmp}.branch" "${tmp}.patch" "${tmp}.lined" 2>/dev/null
+ column_calcdiffs "${@}"
}
## @description handle diffing maven javadoc errors
@@ -446,34 +437,9 @@ function maven_javac_calcdiffs
## @return differences
function maven_javadoc_calcdiffs
{
- declare orig=$1
- declare new=$2
- declare tmp=${PATCH_DIR}/pl.$$.${RANDOM}
-
- # can't use the generic handler for this because of the
- # [WARNING], etc headers.
- # strip :linenum from the output, keeping the filename
- "${SED}" -e 's#:[0-9]*:#:#' "${orig}" > "${tmp}.branch"
- "${SED}" -e 's#:[0-9]*:#:#' "${new}" > "${tmp}.patch"
-
- # compare the errors, generating a string of line
- # numbers. Sorry portability: GNU diff makes this too easy
- ${DIFF} --unchanged-line-format="" \
- --old-line-format="" \
- --new-line-format="%dn " \
- "${tmp}.branch" \
- "${tmp}.patch" > "${tmp}.lined"
-
- # now, pull out those lines of the raw output
- # shellcheck disable=SC2013
- for j in $(cat "${tmp}.lined"); do
- head -"${j}" "${new}" | tail -1
- done
-
- rm "${tmp}.branch" "${tmp}.patch" "${tmp}.lined" 2>/dev/null
+ error_calcdiffs "${@}"
}
-
## @description maven personality handler
## @audience private
## @stability evolving
diff --git a/precommit/src/main/shell/test-patch.d/pathlen.sh b/precommit/src/main/shell/test-patch.d/pathlen.sh
index 50b0abb..4c0f5af 100755
--- a/precommit/src/main/shell/test-patch.d/pathlen.sh
+++ b/precommit/src/main/shell/test-patch.d/pathlen.sh
@@ -71,7 +71,7 @@ function pathlen_generic
size=${#i}
if [[ ${size} -gt ${PATHLEN_SIZE} ]]; then
((counter = counter + 1 ))
- echo "${i}" >> "${PATCH_DIR}/pathlen.txt"
+ echo "${i}:1:path size ${counter}" >> "${PATCH_DIR}/results-pathlen.txt"
fi
done
@@ -79,8 +79,9 @@ function pathlen_generic
echo "${counter} files in the ${msg} with paths longer that ${PATHLEN_SIZE}."
if [[ ${counter} -gt 0 ]] ; then
add_vote_table_v2 -1 pathlen \
- "@@BASE@@/pathlen.txt" \
+ "@@BASE@@/results-pathlen.txt" \
"${BUILDMODEMSG} appears to contain ${counter} files with names longer than ${PATHLEN_SIZE}"
+ bugsystem_linecomments_queue pathlen "${PATCH_DIR}/results-pathlen.txt"
return 1
fi
return 0
diff --git a/precommit/src/main/shell/test-patch.d/unitveto.sh b/precommit/src/main/shell/test-patch.d/unitveto.sh
index 28acb56..22332b9 100755
--- a/precommit/src/main/shell/test-patch.d/unitveto.sh
+++ b/precommit/src/main/shell/test-patch.d/unitveto.sh
@@ -19,6 +19,7 @@
add_test_type unitveto
UNITVETO_RE=${UNITVETO_RE:-}
+UNITVETO_LOGFILE="results-unitveto.txt"
function unitveto_filefilter
{
@@ -27,6 +28,8 @@ function unitveto_filefilter
if [[ -n "${UNITVETO_RE}"
&& ${filename} =~ ${UNITVETO_RE} ]]; then
yetus_debug "unitveto: ${filename} matched"
+ echo "${filename}:1:0:unitveto:matches ${UNITVETO_RE}" \
+ >> "${PATCH_DIR}/${UNITVETO_LOGFILE}"
add_test unitveto
fi
}
@@ -60,6 +63,7 @@ function unitveto_patchfile
return 0
fi
- add_vote_table_v2 -1 unitveto "" "Patch requires manual testing."
+ add_vote_table_v2 -1 unitveto "@@BASE@@/${UNITVETO_LOGFILE}" "Patch requires manual testing."
+ bugsystem_linecomments_queue unitveto "${PATCH_DIR}/${UNITVETO_LOGFILE}"
return 1
}
diff --git a/precommit/src/main/shell/test-patch.sh b/precommit/src/main/shell/test-patch.sh
index 63ed1dc..f806515 100755
--- a/precommit/src/main/shell/test-patch.sh
+++ b/precommit/src/main/shell/test-patch.sh
@@ -400,6 +400,12 @@ function big_console_header
{
local text="$*"
local spacing=$(( (75+${#text}) /2 ))
+
+ if [[ "${ROBOTTYPE}" == 'githubactions' ]]; then
+ echo "::endgroup::"
+ echo "::group::${text}"
+ fi
+
printf '\n\n'
echo "============================================================================"
echo "============================================================================"
@@ -1791,6 +1797,9 @@ function modules_messages
"${testtype}" \
"@@BASE@@/${MODULE_STATUS_LOG[${modindex}]}" \
"${MODULE_STATUS_MSG[${modindex}]}"
+ bugsystem_linecomments_queue \
+ "${testtype}" \
+ "${PATCH_DIR}/${MODULE_STATUS_LOG[${modindex}]}"
else
add_vote_table_v2 \
"${MODULE_STATUS[${modindex}]}" \
@@ -2193,8 +2202,20 @@ function bugsystem_linecomments_queue
return 0
fi
+ for line in "${VOTE_FILTER[@]}"; do
+ if [[ "${plugin}" == "${line}" ]]; then
+ return 0
+ fi
+ done
+
+ pushd "${BASEDIR}" >/dev/null || return 1
while read -r line; do
file=${line%%:*}
+
+ if [[ ! -e "${file}" ]]; then
+ continue
+ fi
+
rol=${line/#${file}:}
if [[ "${file}" =~ ^\./ ]]; then
file=${file:2}
@@ -2214,6 +2235,9 @@ function bugsystem_linecomments_queue
echo "${file}:${linenum}:${column}:${plugin}:${text}" >> "${PATCH_DIR}/linecomments-in.txt"
done < "${fn}"
+
+ popd >/dev/null || return 1
+
}
## @description Write all of the bugsystem linecomments
@@ -2694,9 +2718,9 @@ function module_postlog_compare
"${PATCH_DIR}/branch-${origlog}-${testtype}-${fn}.txt" \
"${PATCH_DIR}/patch-${origlog}-${testtype}-${fn}.txt" \
"${testtype}" \
- > "${PATCH_DIR}/diff-${origlog}-${testtype}-${fn}.txt"
+ > "${PATCH_DIR}/results-${origlog}-${testtype}-${fn}.txt"
- tmpvar=$(wc -l "${PATCH_DIR}/diff-${origlog}-${testtype}-${fn}.txt")
+ tmpvar=$(wc -l "${PATCH_DIR}/results-${origlog}-${testtype}-${fn}.txt")
addpatch=${tmpvar%% *}
((fixedpatch=numbranch-numpatch+addpatch))
@@ -2705,7 +2729,7 @@ function module_postlog_compare
if [[ ${addpatch} -gt 0 ]]; then
((result = result + 1))
- module_status "${i}" -1 "diff-${origlog}-${testtype}-${fn}.txt" "${fn}${statusjdk} ${statstring}"
+ module_status "${i}" -1 "results-${origlog}-${testtype}-${fn}.txt" "${fn}${statusjdk} ${statstring}"
elif [[ ${fixedpatch} -gt 0 ]]; then
module_status "${i}" +1 "${MODULE_STATUS_LOG[${i}]}" "${fn}${statusjdk} ${statstring}"
summarize=false
@@ -2754,11 +2778,7 @@ function root_postlog_compare
touch "${patchlog}"
fi
- if [[ "${BUILDMODE}" == "full" ]]; then
- difflog="results-${testtype}.txt"
- else
- difflog="diff-${testtype}.txt"
- fi
+ difflog="results-${testtype}.txt"
tmpvar=$(wc -l "${branchlog}")
numbranch="${tmpvar%% *}"