You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by en...@apache.org on 2012/12/26 23:06:21 UTC

svn commit: r1426040 - in /hbase/trunk/dev-support: test-patch.properties test-patch.sh

Author: enis
Date: Wed Dec 26 22:06:20 2012
New Revision: 1426040

URL: http://svn.apache.org/viewvc?rev=1426040&view=rev
Log:
HBASE-7427. Check line lenghts in the test-patch script

Modified:
    hbase/trunk/dev-support/test-patch.properties
    hbase/trunk/dev-support/test-patch.sh

Modified: hbase/trunk/dev-support/test-patch.properties
URL: http://svn.apache.org/viewvc/hbase/trunk/dev-support/test-patch.properties?rev=1426040&r1=1426039&r2=1426040&view=diff
==============================================================================
--- hbase/trunk/dev-support/test-patch.properties (original)
+++ hbase/trunk/dev-support/test-patch.properties Wed Dec 26 22:06:20 2012
@@ -21,3 +21,5 @@ MAVEN_OPTS="-Xmx3g"
 OK_RELEASEAUDIT_WARNINGS=84
 OK_FINDBUGS_WARNINGS=226
 OK_JAVADOC_WARNINGS=0
+
+MAX_LINE_LENGTH=100

Modified: hbase/trunk/dev-support/test-patch.sh
URL: http://svn.apache.org/viewvc/hbase/trunk/dev-support/test-patch.sh?rev=1426040&r1=1426039&r2=1426040&view=diff
==============================================================================
--- hbase/trunk/dev-support/test-patch.sh (original)
+++ hbase/trunk/dev-support/test-patch.sh Wed Dec 26 22:06:20 2012
@@ -583,6 +583,34 @@ $JIRA_COMMENT_FOOTER"
 }
 
 ###############################################################################
+### Check line lengths
+checkLineLengths () {
+  echo ""
+  echo ""
+  echo "======================================================================"
+  echo "======================================================================"
+  echo "    Checking that no line have length > $MAX_LINE_LENGTH"
+  echo "======================================================================"
+  echo "======================================================================"
+  echo ""
+  echo ""
+  #see http://en.wikipedia.org/wiki/Diff#Unified_format
+
+  ll=`cat $PATCH_DIR/patch | grep "^+" | grep -v "^@@" | grep -v "^+++" | grep -v "import" | wc -L`
+  MAX_LINE_LENGTH_PATCH=`expr $MAX_LINE_LENGTH + 1`
+  if [[ "$ll" -gt "$MAX_LINE_LENGTH_PATCH" ]]; then
+    JIRA_COMMENT="$JIRA_COMMENT
+
+    {color:red}-1 lineLengths{color}.  The patch introduces lines longer than $MAX_LINE_LENGTH"
+    return 1
+  fi
+  JIRA_COMMENT="$JIRA_COMMENT
+
+    {color:green}+1 lineLengths{color}.  The patch does not introduce lines longer than $MAX_LINE_LENGTH"
+  return 0
+}
+
+###############################################################################
 ### Run the tests
 runTests () {
   echo ""
@@ -782,6 +810,8 @@ checkFindbugsWarnings
 (( RESULT = RESULT + $? ))
 checkReleaseAuditWarnings
 (( RESULT = RESULT + $? ))
+checkLineLengths
+(( RESULT = RESULT + $? ))
 ### Do not call these when run by a developer 
 if [[ $JENKINS == "true" ]] ; then
   runTests