Repository: yetus Updated Branches: refs/heads/master 5056bd973 -> f26542932
YETUS-173. report fixed issues Signed-off-by: Kengo Seki <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/yetus/repo Commit: http://git-wip-us.apache.org/repos/asf/yetus/commit/f2654293 Tree: http://git-wip-us.apache.org/repos/asf/yetus/tree/f2654293 Diff: http://git-wip-us.apache.org/repos/asf/yetus/diff/f2654293 Branch: refs/heads/master Commit: f265429327423ae0468d6c2095ae587d6f084397 Parents: 5056bd9 Author: Allen Wittenauer <[email protected]> Authored: Thu Jan 14 15:00:27 2016 -0800 Committer: Allen Wittenauer <[email protected]> Committed: Sat Jan 16 10:41:01 2016 -0800 ---------------------------------------------------------------------- precommit/test-patch.d/checkstyle.sh | 54 +++++++++++++------------ precommit/test-patch.d/findbugs.sh | 65 ++++++++++++++++++++----------- precommit/test-patch.d/perlcritic.sh | 31 +++++++++------ precommit/test-patch.d/pylint.sh | 30 +++++++------- precommit/test-patch.d/rubocop.sh | 30 ++++++++------ precommit/test-patch.d/ruby-lint.sh | 30 ++++++++------ precommit/test-patch.d/shellcheck.sh | 53 +++++++++++++++---------- precommit/test-patch.sh | 51 +++++++++++++++++++----- 8 files changed, 221 insertions(+), 123 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/yetus/blob/f2654293/precommit/test-patch.d/checkstyle.sh ---------------------------------------------------------------------- diff --git a/precommit/test-patch.d/checkstyle.sh b/precommit/test-patch.d/checkstyle.sh index 09bdbf1..4f46630 100755 --- a/precommit/test-patch.d/checkstyle.sh +++ b/precommit/test-patch.d/checkstyle.sh @@ -296,14 +296,15 @@ function checkstyle_preapply function checkstyle_postapply { - local result - local module - local mod - local fn - local i=0 - local numprepatch=0 - local numpostpatch=0 - local diffpostpatch=0 + declare result + declare module + declare mod + declare fn + declare i=0 + declare numbranch=0 + declare numpatch=0 + declare addpatch=0 + declare summarize=true verify_needed_test checkstyle if [[ $? == 0 ]]; then @@ -345,29 +346,34 @@ function checkstyle_postapply "${PATCH_DIR}/patch-checkstyle-${fn}.txt" \ checkstyle \ > "${PATCH_DIR}/diff-checkstyle-${fn}.txt" + + #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 - diffpostpatch=$(wc -l "${PATCH_DIR}/diff-checkstyle-${fn}.txt" | ${AWK} '{print $1}') + addpatch=$(wc -l "${PATCH_DIR}/diff-checkstyle-${fn}.txt" | ${AWK} '{print $1}') - if [[ ${diffpostpatch} -gt 0 ]] ; then - ((result = result + 1)) + ((fixedpatch=numbranch-numpatch+addpatch)) + + statstring=$(generic_calcdiff_status "${numbranch}" "${numpatch}" "${addpatch}" ) - # shellcheck disable=SC2016 - numprepatch=$(wc -l "${PATCH_DIR}/branch-checkstyle-${fn}.txt" | ${AWK} '{print $1}') - # shellcheck disable=SC2016 - numpostpatch=$(wc -l "${PATCH_DIR}/patch-checkstyle-${fn}.txt" | ${AWK} '{print $1}') - - mod=${module} - if [[ ${mod} == . ]]; then - mod=root - fi - module_status ${i} -1 "diff-checkstyle-${fn}.txt" "Patch generated "\ - "${diffpostpatch} new checkstyle issues in "\ - "${mod} (total was ${numprepatch}, now ${numpostpatch})." + mod=${module} + if [[ ${mod} == . ]]; then + mod=root + fi + + if [[ ${addpatch} -gt 0 ]] ; then + ((result = result + 1)) + module_status ${i} -1 "diff-checkstyle-${fn}.txt" "${mod}: patch ${statstring}" + elif [[ ${fixedpatch} -gt 0 ]]; then + module_status ${i} +1 "diff-checkstyle-${fn}.txt" "${mod}: patch ${statstring}" + summarize=false fi ((i=i+1)) done - modules_messages patch checkstyle true + modules_messages patch checkstyle "${summarize}" if [[ ${result} != 0 ]]; then return 1 http://git-wip-us.apache.org/repos/asf/yetus/blob/f2654293/precommit/test-patch.d/findbugs.sh ---------------------------------------------------------------------- diff --git a/precommit/test-patch.d/findbugs.sh b/precommit/test-patch.d/findbugs.sh index 2419048..4d8dd78 100755 --- a/precommit/test-patch.d/findbugs.sh +++ b/precommit/test-patch.d/findbugs.sh @@ -296,21 +296,24 @@ function findbugs_preapply ## @return 1 on failure function findbugs_postinstall { - local module - local fn - local combined_xml - local branchxml - local patchxml - local newbugsbase - local fixedbugsbase - local new_findbugs_warnings - local fixed_findbugs_warnings - local line - local firstpart - local secondpart - local i=0 - local result=0 - local savestop + declare module + declare fn + declare combined_xml + declare branchxml + declare patchxml + declare newbugsbase + declare fixedbugsbase + declare branch_warnings + declare patch_warnings + declare fixed_warnings + declare line + declare firstpart + declare secondpart + declare i=0 + declare result=0 + declare savestop + declare summarize=true + declare statstring verify_needed_test findbugs if [[ $? == 0 ]]; then @@ -346,7 +349,14 @@ function findbugs_postinstall branchxml="${PATCH_DIR}/branch-findbugs-${fn}-warnings.xml" patchxml="${PATCH_DIR}/patch-findbugs-${fn}-warnings.xml" - if [[ ! -f "${branchxml}" ]]; then + if [[ -f "${branchxml}" ]]; then + # shellcheck disable=SC2016 + branch_warnings=$("${FINDBUGS_HOME}/bin/filterBugs" -first \ + "${PATCH_BRANCH}" \ + "${branchxml}" \ + "${branchxml}" \ + | ${AWK} '{print $1}') + else branchxml=${patchxml} fi @@ -369,8 +379,15 @@ function findbugs_postinstall continue fi + # shellcheck disable=SC2016 + patch_warnings=$("${FINDBUGS_HOME}/bin/filterBugs" -first \ + "patch" \ + "${patchxml}" \ + "${patchxml}" \ + | ${AWK} '{print $1}') + #shellcheck disable=SC2016 - new_findbugs_warnings=$("${FINDBUGS_HOME}/bin/filterBugs" -first patch \ + add_warnings=$("${FINDBUGS_HOME}/bin/filterBugs" -first patch \ "${combined_xml}" "${newbugsbase}.xml" | ${AWK} '{print $1}') if [[ $? != 0 ]]; then popd >/dev/null @@ -383,7 +400,7 @@ function findbugs_postinstall fi #shellcheck disable=SC2016 - fixed_findbugs_warnings=$("${FINDBUGS_HOME}/bin/filterBugs" -fixed patch \ + fixed_warnings=$("${FINDBUGS_HOME}/bin/filterBugs" -fixed patch \ "${combined_xml}" "${fixedbugsbase}.xml" | ${AWK} '{print $1}') if [[ $? != 0 ]]; then popd >/dev/null @@ -395,7 +412,7 @@ function findbugs_postinstall continue fi - echo "Found ${new_findbugs_warnings} new Findbugs warnings and ${fixed_findbugs_warnings} newly fixed warnings." + statstring=$(generic_calcdiff_status "${branch_warnings}" "${patch_warnings}" "${add_warnings}") "${FINDBUGS_HOME}/bin/convertXmlToText" -html "${newbugsbase}.xml" \ "${newbugsbase}.html" @@ -409,7 +426,7 @@ function findbugs_postinstall continue fi - if [[ ${new_findbugs_warnings} -gt 0 ]] ; then + if [[ ${add_warnings} -gt 0 ]] ; then populate_test_table FindBugs "module:${module}" #shellcheck disable=SC2162 while read line; do @@ -418,9 +435,11 @@ function findbugs_postinstall add_test_table "" "${firstpart}:${secondpart}" done < <("${FINDBUGS_HOME}/bin/convertXmlToText" "${newbugsbase}.xml") - module_status ${i} -1 "new-findbugs-${fn}.html" "${module} introduced "\ - "${new_findbugs_warnings} new FindBugs issues." + module_status ${i} -1 "new-findbugs-${fn}.html" "${module} ${statstring}" ((result=result+1)) + elif [[ ${fixed_warnings} -gt 0 ]]; then + module_status ${i} +1 "" "${module} ${statstring}" + summarize=false fi savestop=$(stop_clock) MODULE_STATUS_TIMER[${i}]=${savestop} @@ -428,7 +447,7 @@ function findbugs_postinstall ((i=i+1)) done - modules_messages patch findbugs true + modules_messages patch findbugs "${summarize}" if [[ ${result} != 0 ]]; then return 1 fi http://git-wip-us.apache.org/repos/asf/yetus/blob/f2654293/precommit/test-patch.d/perlcritic.sh ---------------------------------------------------------------------- diff --git a/precommit/test-patch.d/perlcritic.sh b/precommit/test-patch.d/perlcritic.sh index 98e10e5..79a43bc 100755 --- a/precommit/test-patch.d/perlcritic.sh +++ b/precommit/test-patch.d/perlcritic.sh @@ -96,10 +96,12 @@ function perlcritic_calcdiffs function perlcritic_postapply { - local i - local numPrepatch - local numPostpatch - local diffPostpatch + declare i + declare numPrepatch + declare numPostpatch + declare diffPostpatch + declare fixedpatch + declare statstring verify_needed_test perlcritic if [[ $? == 0 ]]; then @@ -132,20 +134,27 @@ function perlcritic_postapply "${PATCH_DIR}/patch-perlcritic-result.txt" \ perlcritic \ > "${PATCH_DIR}/diff-patch-perlcritic.txt" + + # shellcheck disable=SC2016 + numPrepatch=$(wc -l "${PATCH_DIR}/branch-perlcritic-result.txt" | ${AWK} '{print $1}') + + # shellcheck disable=SC2016 + numPostpatch=$(wc -l "${PATCH_DIR}/patch-perlcritic-result.txt" | ${AWK} '{print $1}') + # shellcheck disable=SC2016 diffPostpatch=$(wc -l "${PATCH_DIR}/diff-patch-perlcritic.txt" | ${AWK} '{print $1}') - if [[ ${diffPostpatch} -gt 0 ]] ; then - # shellcheck disable=SC2016 - numPrepatch=$(wc -l "${PATCH_DIR}/branch-perlcritic-result.txt" | ${AWK} '{print $1}') + ((fixedpatch=numPrepatch-numPostpatch+diffPostpatch)) - # shellcheck disable=SC2016 - numPostpatch=$(wc -l "${PATCH_DIR}/patch-perlcritic-result.txt" | ${AWK} '{print $1}') + statstring=$(generic_calcdiff_status "${numPrepatch}" "${numPostpatch}" "${diffPostpatch}" ) - add_vote_table -1 perlcritic "The applied patch generated "\ - "${diffPostpatch} new Perl::Critic issues (total was ${numPrepatch}, now ${numPostpatch})." + if [[ ${diffPostpatch} -gt 0 ]]; then + add_vote_table -1 perlcritic "The applied patch ${statstring}" add_footer_table perlcritic "@@BASE@@/diff-patch-perlcritic.txt" return 1 + elif [[ ${fixedpatch} -gt 0 ]]; then + add_vote_table +1 perlcritic "The applied patch ${statstring}" + return 0 fi add_vote_table +1 perlcritic "There were no new perlcritic issues." http://git-wip-us.apache.org/repos/asf/yetus/blob/f2654293/precommit/test-patch.d/pylint.sh ---------------------------------------------------------------------- diff --git a/precommit/test-patch.d/pylint.sh b/precommit/test-patch.d/pylint.sh index 3e48197..a5b809a 100755 --- a/precommit/test-patch.d/pylint.sh +++ b/precommit/test-patch.d/pylint.sh @@ -101,12 +101,14 @@ function pylint_preapply function pylint_postapply { - local i - local count - local numPrepatch - local numPostpatch - local diffPostpatch - local pylintStderr=patch-pylint-stderr.txt + declare i + declare count + declare numPrepatch + declare numPostpatch + declare diffPostpatch + declare pylintStderr=patch-pylint-stderr.txt + declare fixedpatch + declare statstring verify_needed_test pylint if [[ $? == 0 ]]; then @@ -147,19 +149,21 @@ function pylint_postapply add_footer_table pylint "v${PYLINT_VERSION%,}" calcdiffs "${PATCH_DIR}/branch-pylint-result.txt" "${PATCH_DIR}/patch-pylint-result.txt" > "${PATCH_DIR}/diff-patch-pylint.txt" + numPrepatch=$(${GREP} -c "^.*:.*: \[.*\] " "${PATCH_DIR}/branch-pylint-result.txt") + numPostpatch=$(${GREP} -c "^.*:.*: \[.*\] " "${PATCH_DIR}/patch-pylint-result.txt") diffPostpatch=$(${GREP} -c "^.*:.*: \[.*\] " "${PATCH_DIR}/diff-patch-pylint.txt") - if [[ ${diffPostpatch} -gt 0 ]] ; then - # shellcheck disable=SC2016 - numPrepatch=$(${GREP} -c "^.*:.*: \[.*\] " "${PATCH_DIR}/branch-pylint-result.txt") + ((fixedpatch=numPrepatch-numPostpatch+diffPostpatch)) - # shellcheck disable=SC2016 - numPostpatch=$(${GREP} -c "^.*:.*: \[.*\] " "${PATCH_DIR}/patch-pylint-result.txt") + statstring=$(generic_calcdiff_status "${numPrepatch}" "${numPostpatch}" "${diffPostpatch}" ) - add_vote_table -1 pylint "The applied patch generated "\ - "${diffPostpatch} new pylint issues (total was ${numPrepatch}, now ${numPostpatch})." + if [[ ${diffPostpatch} -gt 0 ]] ; then + add_vote_table -1 pylint "The applied patch ${statstring}" add_footer_table pylint "@@BASE@@/diff-patch-pylint.txt" return 1 + elif [[ ${fixedpatch} -gt 0 ]]; then + add_vote_table +1 pylint "The applied patch ${statstring}" + return 0 fi add_vote_table +1 pylint "There were no new pylint issues." http://git-wip-us.apache.org/repos/asf/yetus/blob/f2654293/precommit/test-patch.d/rubocop.sh ---------------------------------------------------------------------- diff --git a/precommit/test-patch.d/rubocop.sh b/precommit/test-patch.d/rubocop.sh index 94cb3a4..a75b636 100755 --- a/precommit/test-patch.d/rubocop.sh +++ b/precommit/test-patch.d/rubocop.sh @@ -96,10 +96,12 @@ function rubocop_calcdiffs function rubocop_postapply { - local i - local numPrepatch - local numPostpatch - local diffPostpatch + declare i + declare numPrepatch + declare numPostpatch + declare diffPostpatch + declare fixedpatch + declare statstring verify_needed_test rubocop if [[ $? == 0 ]]; then @@ -135,17 +137,23 @@ function rubocop_postapply > "${PATCH_DIR}/diff-patch-rubocop.txt" diffPostpatch=$(${AWK} -F: 'BEGIN {sum=0} 4<NF {sum+=1} END {print sum}' "${PATCH_DIR}/diff-patch-rubocop.txt") - if [[ ${diffPostpatch} -gt 0 ]] ; then - # shellcheck disable=SC2016 - numPrepatch=$(${AWK} -F: 'BEGIN {sum=0} 4<NF {sum+=1} END {print sum}' "${PATCH_DIR}/branch-rubocop-result.txt") + # shellcheck disable=SC2016 + numPrepatch=$(${AWK} -F: 'BEGIN {sum=0} 4<NF {sum+=1} END {print sum}' "${PATCH_DIR}/branch-rubocop-result.txt") + + # shellcheck disable=SC2016 + numPostpatch=$(${AWK} -F: 'BEGIN {sum=0} 4<NF {sum+=1} END {print sum}' "${PATCH_DIR}/patch-rubocop-result.txt") + + ((fixedpatch=numPrepatch-numPostpatch+diffPostpatch)) - # shellcheck disable=SC2016 - numPostpatch=$(${AWK} -F: 'BEGIN {sum=0} 4<NF {sum+=1} END {print sum}' "${PATCH_DIR}/patch-rubocop-result.txt") + statstring=$(generic_calcdiff_status "${numPrepatch}" "${numPostpatch}" "${diffPostpatch}" ) - add_vote_table -1 rubocop "The applied patch generated "\ - "${diffPostpatch} new rubocop issues (total was ${numPrepatch}, now ${numPostpatch})." + if [[ ${diffPostpatch} -gt 0 ]] ; then + add_vote_table -1 rubocop "The applied patch ${statstring}" add_footer_table rubocop "@@BASE@@/diff-patch-rubocop.txt" return 1 + elif [[ ${fixedpatch} -gt 0 ]]; then + add_vote_table +1 rubocop "The applied patch ${statstring}" + return 0 fi add_vote_table +1 rubocop "There were no new rubocop issues." http://git-wip-us.apache.org/repos/asf/yetus/blob/f2654293/precommit/test-patch.d/ruby-lint.sh ---------------------------------------------------------------------- diff --git a/precommit/test-patch.d/ruby-lint.sh b/precommit/test-patch.d/ruby-lint.sh index eddc48f..1586d34 100755 --- a/precommit/test-patch.d/ruby-lint.sh +++ b/precommit/test-patch.d/ruby-lint.sh @@ -126,10 +126,12 @@ function ruby_lint_calcdiffs function ruby_lint_postapply { - local i - local numPrepatch - local numPostpatch - local diffPostpatch + declare i + declare numPrepatch + declare numPostpatch + declare diffPostpatch + declare fixedpatch + declare statstring verify_needed_test ruby_lint if [[ $? == 0 ]]; then @@ -165,17 +167,23 @@ function ruby_lint_postapply > "${PATCH_DIR}/diff-patch-ruby-lint.txt" diffPostpatch=$(${AWK} -F: 'BEGIN {sum=0} 4<NF {sum+=1} END {print sum}' "${PATCH_DIR}/diff-patch-ruby-lint.txt") - if [[ ${diffPostpatch} -gt 0 ]] ; then - # shellcheck disable=SC2016 - numPrepatch=$(${AWK} -F: 'BEGIN {sum=0} 4<NF {sum+=1} END {print sum}' "${PATCH_DIR}/branch-ruby-lint-result.txt") + # shellcheck disable=SC2016 + numPrepatch=$(${AWK} -F: 'BEGIN {sum=0} 4<NF {sum+=1} END {print sum}' "${PATCH_DIR}/branch-ruby-lint-result.txt") + + # shellcheck disable=SC2016 + numPostpatch=$(${AWK} -F: 'BEGIN {sum=0} 4<NF {sum+=1} END {print sum}' "${PATCH_DIR}/patch-ruby-lint-result.txt") + + ((fixedpatch=numPrepatch-numPostpatch+diffPostpatch)) - # shellcheck disable=SC2016 - numPostpatch=$(${AWK} -F: 'BEGIN {sum=0} 4<NF {sum+=1} END {print sum}' "${PATCH_DIR}/patch-ruby-lint-result.txt") + statstring=$(generic_calcdiff_status "${numPrepatch}" "${numPostpatch}" "${diffPostpatch}" ) - add_vote_table -1 ruby-lint "The applied patch generated "\ - "${diffPostpatch} new ruby-lint issues (total was ${numPrepatch}, now ${numPostpatch})." + if [[ ${diffPostpatch} -gt 0 ]] ; then + add_vote_table -1 ruby-lint "The applied patch ${statstring}" add_footer_table ruby-lint "@@BASE@@/diff-patch-ruby-lint.txt" return 1 + elif [[ ${fixedpatch} -gt 0 ]]; then + add_vote_table +1 ruby-lint "The applied patch ${statstring}" + return 0 fi add_vote_table +1 ruby-lint "There were no new ruby-lint issues." http://git-wip-us.apache.org/repos/asf/yetus/blob/f2654293/precommit/test-patch.d/shellcheck.sh ---------------------------------------------------------------------- diff --git a/precommit/test-patch.d/shellcheck.sh b/precommit/test-patch.d/shellcheck.sh index c42822d..5b0b524 100755 --- a/precommit/test-patch.d/shellcheck.sh +++ b/precommit/test-patch.d/shellcheck.sh @@ -71,7 +71,8 @@ function shellcheck_private_findbash function shellcheck_preapply { - local i + declare i + declare msg verify_needed_test shellcheck if [[ $? == 0 ]]; then @@ -90,6 +91,15 @@ function shellcheck_preapply fi done popd > /dev/null + + # shellcheck disable=SC2016 + SHELLCHECK_VERSION=$(${SHELLCHECK} --version | ${GREP} version: | ${AWK} '{print $NF}') + msg="v${SHELLCHECK_VERSION}" + if [[ ${SHELLCHECK_VERSION} =~ 0.[0-3].[0-5] ]]; then + msg="${msg} (This is an old version that has serious bugs. Consider upgrading.)" + fi + add_footer_table shellcheck "${msg}" + # keep track of how much as elapsed for us already SHELLCHECK_TIMER=$(stop_clock) return 0 @@ -109,11 +119,12 @@ function shellcheck_calcdiffs function shellcheck_postapply { - local i - local msg - local numPrepatch - local numPostpatch - local diffPostpatch + declare i + declare numPrepatch + declare numPostpatch + declare diffPostpatch + declare fixedpatch + declare statstring verify_needed_test shellcheck if [[ $? == 0 ]]; then @@ -140,34 +151,34 @@ function shellcheck_postapply touch "${PATCH_DIR}/branch-shellcheck-result.txt" fi - # shellcheck disable=SC2016 - SHELLCHECK_VERSION=$(${SHELLCHECK} --version | ${GREP} version: | ${AWK} '{print $NF}') - msg="v${SHELLCHECK_VERSION}" - if [[ ${SHELLCHECK_VERSION} =~ 0.[0-3].[0-5] ]]; then - msg="${msg} (This is an old version that has serious bugs. Consider upgrading.)" - fi - add_footer_table shellcheck "${msg}" - calcdiffs \ "${PATCH_DIR}/branch-shellcheck-result.txt" \ "${PATCH_DIR}/patch-shellcheck-result.txt" \ shellcheck \ > "${PATCH_DIR}/diff-patch-shellcheck.txt" + + # shellcheck disable=SC2016 + numPrepatch=$(wc -l "${PATCH_DIR}/branch-shellcheck-result.txt" | ${AWK} '{print $1}') + + # shellcheck disable=SC2016 + numPostpatch=$(wc -l "${PATCH_DIR}/patch-shellcheck-result.txt" | ${AWK} '{print $1}') + # shellcheck disable=SC2016 diffPostpatch=$(wc -l "${PATCH_DIR}/diff-patch-shellcheck.txt" | ${AWK} '{print $1}') - if [[ ${diffPostpatch} -gt 0 ]] ; then - # shellcheck disable=SC2016 - numPrepatch=$(wc -l "${PATCH_DIR}/branch-shellcheck-result.txt" | ${AWK} '{print $1}') - # shellcheck disable=SC2016 - numPostpatch=$(wc -l "${PATCH_DIR}/patch-shellcheck-result.txt" | ${AWK} '{print $1}') + ((fixedpatch=numPrepatch-numPostpatch+diffPostpatch)) - add_vote_table -1 shellcheck "The applied patch generated "\ - "${diffPostpatch} new shellcheck issues (total was ${numPrepatch}, now ${numPostpatch})." + statstring=$(generic_calcdiff_status "${numPrepatch}" "${numPostpatch}" "${diffPostpatch}" ) + + if [[ ${diffPostpatch} -gt 0 ]] ; then + add_vote_table -1 shellcheck "The applied patch ${statstring}" add_footer_table shellcheck "@@BASE@@/diff-patch-shellcheck.txt" bugsystem_linecomments "shellcheck" "${PATCH_DIR}/diff-patch-shellcheck.txt" return 1 + elif [[ ${fixedpatch} -gt 0 ]]; then + add_vote_table +1 shellcheck "The applied patch ${statstring}" + return 0 fi add_vote_table +1 shellcheck "There were no new shellcheck issues." http://git-wip-us.apache.org/repos/asf/yetus/blob/f2654293/precommit/test-patch.sh ---------------------------------------------------------------------- diff --git a/precommit/test-patch.sh b/precommit/test-patch.sh index 328630f..471efa7 100755 --- a/precommit/test-patch.sh +++ b/precommit/test-patch.sh @@ -2247,6 +2247,33 @@ function calcdiffs fi } +## @description generate a standarized calcdiff status message +## @audience public +## @stability evolving +## @replaceable no +## @param totalbranchissues +## @param totalpatchissues +## @param newpatchissues +## @return errorstring +function generic_calcdiff_status +{ + declare numbranch=$1 + declare numpatch=$2 + declare addpatch=$3 + declare samepatch + declare fixedpatch + + ((samepatch=numpatch-addpatch)) + ((fixedpatch=numbranch-numpatch+addpatch)) + + printf "generated %i new + %i unchanged - %i fixed = %i total (was %i)" \ + "${addpatch}" \ + "${samepatch}" \ + "${fixedpatch}" \ + "${numpatch}" \ + "${numbranch}" +} + ## @description Helper routine for plugins to ask projects, etc ## @description to count problems in a log file ## @description and output it to stdout. @@ -2342,7 +2369,10 @@ function generic_postlog_compare declare statusjdk declare numbranch declare numpatch - declare diffpatch + declare addpatch + declare samepatch + declare fixedpatch + declare summarize=true if [[ ${multijdk} == true ]]; then jdk=$(report_jvm_version "${JAVA_HOME}") @@ -2389,21 +2419,24 @@ function generic_postlog_compare "${testtype}" \ > "${PATCH_DIR}/diff-${origlog}-${testtype}-${fn}.txt" - diffpatch=$(wc -l "${PATCH_DIR}/diff-${origlog}-${testtype}-${fn}.txt" | ${AWK} '{print $1}') + # shellcheck disable=SC2016 + addpatch=$(wc -l "${PATCH_DIR}/diff-${origlog}-${testtype}-${fn}.txt" | ${AWK} '{print $1}') - echo "" - echo "${module_suffix}/${testtype}: ${diffpatch} new issues (was ${numbranch}, now ${numpatch})." + ((fixedpatch=numbranch-numpatch+addpatch)) - if [[ ${diffpatch} -gt 0 ]] ; then - ((result = result + 1)) + statstring=$(generic_calcdiff_status "${numbranch}" "${numpatch}" "${addpatch}" ) - add_vote_table -1 "${testtype}" "${fn}${statusjdk} generated " \ - "${diffpatch} new issues (was ${numbranch}, now ${numpatch}). " + if [[ ${addpatch} -gt 0 ]]; then + ((result = result + 1)) + add_vote_table -1 "${testtype}" "${fn}${statusjdk} ${statstring}" add_footer_table "${testtype}" "${fn}: @@BASE@@/diff-${origlog}-${testtype}-${fn}.txt" + elif [[ ${fixedpatch} -gt 0 ]]; then + add_vote_table +1 "${testtype}" "${fn}${statusjdk} ${statstring}" + summarize=false fi ((i=i+1)) done - modules_messages patch "${testtype}" true + modules_messages patch "${testtype}" "${summarize}" if [[ ${result} -gt 0 ]]; then return 1 fi
