From 4f671e7419afe83eb0f0016504c168f14a450f0f Mon Sep 17 00:00:00 2001 From: Sean Busbey Date: Mon, 23 Apr 2018 16:51:49 -0500 Subject: [PATCH] HBASE-20478 hbase-anti precommit test should log details and add a footer as needed. --- dev-support/hbase-personality.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/dev-support/hbase-personality.sh b/dev-support/hbase-personality.sh index b010503553..8da36d2421 100755 --- a/dev-support/hbase-personality.sh +++ b/dev-support/hbase-personality.sh @@ -611,6 +611,7 @@ function hbaseanti_patchfile local patchfile=$1 local warnings local result + local logfile if [[ "${BUILDMODE}" = full ]]; then return 0 @@ -621,34 +622,63 @@ function hbaseanti_patchfile fi big_console_header "Checking for known anti-patterns" + logfile="patchfile-hbaseanti-results.txt" + true > "${PATCH_DIR}/${logfile}" + # note that this same starting point will be used for each of our votes below, + # but this test takes < 1s in total normally, so they should all basically read 0. start_clock warnings=$(${GREP} -c 'new TreeMap>"${PATCH_DIR}/${logfile}" ((result=result+1)) fi warnings=$(${GREP} -c 'import org.apache.hadoop.classification' "${patchfile}") if [[ ${warnings} -gt 0 ]]; then add_vote_table -1 hbaseanti "" "The patch appears use Hadoop classification instead of HBase." + echo "Use of Hadoop classification annotations in patch" + { + printf 'Use of Hadoop classification annotations in patchfile\n------\n' + ${GREP} -n 'import org.apache.hadoop.classification' "${patchfile}" + echo "-------" + } >>"${PATCH_DIR}/${logfile}" ((result=result+1)) fi warnings=$(${GREP} -c 'import org.codehaus.jackson' "${patchfile}") if [[ ${warnings} -gt 0 ]]; then add_vote_table -1 hbaseanti "" "The patch appears use Jackson 1 classes/annotations." + echo "Use of Jackson 1 classes/annotations in patch" + { + printf 'Use of Jackson 1 classes/annotations in patchfile\n------\n' + ${GREP} -n 'import org.codehaus.jackson' "${patchfile}" + echo "-------" + } >>"${PATCH_DIR}/${logfile}" ((result=result+1)) fi warnings=$(${GREP} -cE 'org.apache.commons.logging.Log(Factory|;)' "${patchfile}") if [[ ${warnings} -gt 0 ]]; then add_vote_table -1 hbaseanti "" "The patch appears to use commons-logging instead of slf4j." + echo "Use of commons-logging instead of slf4j in patch" + { + printf 'Use of commons-logging instead of slf4j in patchfile\n------\n' + ${GREP} -n -E 'org.apache.commons.logging.Log(Factory|;)' "${patchfile}" + echo "-------" + } >>"${PATCH_DIR}/${logfile}" ((result=result+1)) fi if [[ ${result} -gt 0 ]]; then + add_footer_table hbaseanti "@@BASE@@/${logfile}" return 1 fi -- 2.16.1