diff --git dev-support/test-patch.properties dev-support/test-patch.properties index 3374978..75a0e79 100644 --- dev-support/test-patch.properties +++ dev-support/test-patch.properties @@ -21,3 +21,5 @@ MAVEN_OPTS="-Xmx3g" OK_RELEASEAUDIT_WARNINGS=84 OK_FINDBUGS_WARNINGS=517 OK_JAVADOC_WARNINGS=169 + +MAX_LINE_LENGTH=100 diff --git dev-support/test-patch.sh dev-support/test-patch.sh index f76c52a..33a5a98 100755 --- dev-support/test-patch.sh +++ dev-support/test-patch.sh @@ -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` + if [[ "$ll" -gt "$MAX_LINE_LENGTH" ]]; 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 findbugs{color}. The patch does not introduce long lines" + return 0 +} + ############################################################################### ### Run the tests runTests () { @@ -773,6 +801,8 @@ checkFindbugsWarnings (( RESULT = RESULT + $? )) checkReleaseAuditWarnings (( RESULT = RESULT + $? )) +checkLineLengths +(( RESULT = RESULT + $? )) ### Do not call these when run by a developer if [[ $JENKINS == "true" ]] ; then runTests