Repository: oozie
Updated Branches:
  refs/heads/master 4145a9dc8 -> 95f0d163f


OOZIE-3277 [build] Check for star imports (kmarton via andras.piros)


Project: http://git-wip-us.apache.org/repos/asf/oozie/repo
Commit: http://git-wip-us.apache.org/repos/asf/oozie/commit/95f0d163
Tree: http://git-wip-us.apache.org/repos/asf/oozie/tree/95f0d163
Diff: http://git-wip-us.apache.org/repos/asf/oozie/diff/95f0d163

Branch: refs/heads/master
Commit: 95f0d163fd593201566cd5123f182995bebf6748
Parents: 4145a9d
Author: Andras Piros <andras.pi...@cloudera.com>
Authored: Fri Oct 5 15:10:23 2018 +0200
Committer: Andras Piros <andras.pi...@cloudera.com>
Committed: Fri Oct 5 15:10:23 2018 +0200

----------------------------------------------------------------------
 bin/test-patch-05-patch-raw-analysis | 33 ++++++++++++++++++++-----------
 release-log.txt                      |  2 ++
 2 files changed, 23 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/oozie/blob/95f0d163/bin/test-patch-05-patch-raw-analysis
----------------------------------------------------------------------
diff --git a/bin/test-patch-05-patch-raw-analysis 
b/bin/test-patch-05-patch-raw-analysis
index cec7138..5bad244 100755
--- a/bin/test-patch-05-patch-raw-analysis
+++ b/bin/test-patch-05-patch-raw-analysis
@@ -16,7 +16,6 @@ if [ "${TESTPATCHDEBUG}" == "true" ] ; then
   set -x
 fi
 
-BASEDIR=$(pwd)
 TASKNAME="RAW_PATCH_ANALYSIS"
 OP=""
 TEMPDIR=""
@@ -26,7 +25,7 @@ PATCHFILE=""
 
 ###############################################################################
 cleanupAndExit() {
-  exit $1
+  exit "$1"
 }
 ###############################################################################
 printUsage() {
@@ -36,7 +35,7 @@ printUsage() {
 }
 ###############################################################################
 parseArgs() {
-  for i in $*
+  for i in "$@"
   do
     case $i in
     --taskname)
@@ -75,7 +74,7 @@ parseArgs() {
 }
 ###############################################################################
 checkNoAuthors() {
-  authorTags=`grep "^+" ${PATCHFILE} | grep -v "^+++" | grep -c -i -e ".*\*.* 
@author"`
+  authorTags=$(grep "^+" "${PATCHFILE}" | grep -v "^+++" | grep -c -i -e 
".*\*.* @author")
   if [[ ${authorTags} != 0 ]] ; then
     REPORT+=("{color:red}-1{color} the patch seems to contain ${authorTags} 
line(s) with @author tags")
   else
@@ -84,7 +83,7 @@ checkNoAuthors() {
 }
 ###############################################################################
 checkNoTabs() {
-  tabs=`grep "^+" ${PATCHFILE} | grep -v "^+++" | grep -c $'\t'`
+  tabs=$(grep "^+" "${PATCHFILE}" | grep -v "^+++" | grep -c $'\t')
   if [[ ${tabs} != 0 ]] ; then
     REPORT+=("{color:red}-1{color} the patch contains ${tabs} line(s) with 
tabs")
   else
@@ -93,7 +92,7 @@ checkNoTabs() {
 }
 ###############################################################################
 checkNoTrailingSpaces() {
-  trailingSpaces=`grep "^+" ${PATCHFILE} | grep -v "^+++" | grep -c -e " $"`
+  trailingSpaces=$(grep "^+" "${PATCHFILE}" | grep -v "^+++" | grep -c -e " $")
   if [[ ${trailingSpaces} != 0 ]] ; then
     REPORT+=("{color:red}-1{color} the patch contains ${trailingSpaces} 
line(s) with trailing spaces")
   else
@@ -103,7 +102,7 @@ checkNoTrailingSpaces() {
 ###############################################################################
 checkLinesLength() {
   # We check for > 133 to account for the "+" sign
-  longLines=`grep "^+" ${PATCHFILE} | grep -v "^+++" | awk 'BEGIN{count=0}{if 
( length > 133 ) { count=count+1} }END{ print count}'`
+  longLines=$(grep "^+" "${PATCHFILE}" | grep -v "^+++" | awk 
'BEGIN{count=0}{if ( length > 133 ) { count=count+1} }END{ print count}')
   if [[ ${longLines} != 0 ]] ; then
     REPORT+=("{color:red}-1{color} the patch contains ${longLines} line(s) 
longer than 132 characters")
   else
@@ -112,7 +111,7 @@ checkLinesLength() {
 }
 ###############################################################################
 checkForTestcases() {
-  testcases=`grep -c -i -e '^+++.*/test.*java' ${PATCHFILE}`
+  testcases=$(grep -c -i -e '^+++.*/test.*java' "${PATCHFILE}")
   if [[ ${testcases} == 0 ]] ; then
     REPORT+=("{color:red}-1{color} the patch does not add/modify any testcase")
     #reverting for summary +1 calculation
@@ -124,6 +123,15 @@ checkForTestcases() {
   fi
 }
 ###############################################################################
+checkNoStarImports() {
+    starImports=$(grep -c "\+\s*import[a-zA-Z .]*\*" "${PATCHFILE}")
+    if [[ ${starImports} != 0 ]] ; then
+      REPORT+=("{color:red}-1{color} the patch contains ${starImports} star 
import(s)")
+    else
+      REPORT+=("{color:green}+1{color} the patch does not introduce any star 
imports")
+    fi
+}
+###############################################################################
 
 parseArgs "$@"
 
@@ -137,16 +145,17 @@ case $OP in
     checkNoAuthors
     checkNoTabs
     checkNoTrailingSpaces
+    checkNoStarImports
     checkLinesLength
     checkForTestcases
-    total=`expr $authorTags + $tabs + $trailingSpaces + $longLines + 
$testcases`
+    total=$((authorTags + tabs + trailingSpaces + longLines + testcases + 
starImports))
     if [[ $total == 0 ]] ; then
-      echo "{color:green}+1 ${TASKNAME}{color}" >> $SUMMARYFILE
+      echo "{color:green}+1 ${TASKNAME}{color}" >> "$SUMMARYFILE"
     else
-      echo "{color:red}-1 ${TASKNAME}{color}" >> $SUMMARYFILE
+      echo "{color:red}-1 ${TASKNAME}{color}" >> "$SUMMARYFILE"
     fi
     for line in "${REPORT[@]}" ; do
-      echo ".    ${line}" >> $SUMMARYFILE
+      echo ".    ${line}" >> "$SUMMARYFILE"
     done
     ;;
 esac

http://git-wip-us.apache.org/repos/asf/oozie/blob/95f0d163/release-log.txt
----------------------------------------------------------------------
diff --git a/release-log.txt b/release-log.txt
index 6339991..bfffc5b 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -1,5 +1,7 @@
 -- Oozie 5.2.0 release (trunk - unreleased)
 
+OOZIE-3277 [build] Check for star imports (kmarton via andras.piros)
+
 -- Oozie 5.1.0 release
 
 OOZIE-3358 [docs] Check and fix differences between help and command line 
documentation for Fluent Job API (kmarton via andras.piros)

Reply via email to