HBASE-7427. Check line lenghts in the test-patch script

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1426040 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Enis Soztutar 2012-12-26 22:06:20 +00:00
parent 73b021f90a
commit 1ae751a725
2 changed files with 32 additions and 0 deletions

View File

@ -21,3 +21,5 @@ MAVEN_OPTS="-Xmx3g"
OK_RELEASEAUDIT_WARNINGS=84
OK_FINDBUGS_WARNINGS=226
OK_JAVADOC_WARNINGS=0
MAX_LINE_LENGTH=100

View File

@ -582,6 +582,34 @@ $JIRA_COMMENT_FOOTER"
return 0
}
###############################################################################
### 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 () {
@ -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