You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zookeeper.apache.org by si...@apache.org on 2013/07/20 20:18:56 UTC
svn commit: r1505180 - in /zookeeper/bookkeeper/branches/branch-4.2:
CHANGES.txt bin/raw-check-patch bin/test-patch-05-patch-raw-analysis
Author: sijie
Date: Sat Jul 20 18:18:55 2013
New Revision: 1505180
URL: http://svn.apache.org/r1505180
Log:
BOOKKEEPER-635: jenkins build should highlight which lines of the patch cause raw analysis errors (ivank via sijie)
Added:
zookeeper/bookkeeper/branches/branch-4.2/bin/raw-check-patch
Modified:
zookeeper/bookkeeper/branches/branch-4.2/CHANGES.txt
zookeeper/bookkeeper/branches/branch-4.2/bin/test-patch-05-patch-raw-analysis
Modified: zookeeper/bookkeeper/branches/branch-4.2/CHANGES.txt
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/branches/branch-4.2/CHANGES.txt?rev=1505180&r1=1505179&r2=1505180&view=diff
==============================================================================
--- zookeeper/bookkeeper/branches/branch-4.2/CHANGES.txt (original)
+++ zookeeper/bookkeeper/branches/branch-4.2/CHANGES.txt Sat Jul 20 18:18:55 2013
@@ -4,6 +4,8 @@ Release 4.2.2 - Unreleased
BUGFIXES:
+ BOOKKEEPER-635: jenkins build should highlight which lines of the patch cause raw analysis errors (ivank via sijie)
+
bookkeeper-server:
BOOKKEEPER-559: Fix occasional failure in AuditorBookieTest (ivank)
Added: zookeeper/bookkeeper/branches/branch-4.2/bin/raw-check-patch
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/branches/branch-4.2/bin/raw-check-patch?rev=1505180&view=auto
==============================================================================
--- zookeeper/bookkeeper/branches/branch-4.2/bin/raw-check-patch (added)
+++ zookeeper/bookkeeper/branches/branch-4.2/bin/raw-check-patch Sat Jul 20 18:18:55 2013
@@ -0,0 +1,47 @@
+#!/usr/bin/env bash
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+printTrailingSpaces() {
+ PATCH=$1
+ cat $PATCH | awk '/^+/ { if (/ $/) { print "\tL" NR ":" $0} }'
+}
+
+printTabs() {
+ PATCH=$1
+ cat $PATCH | awk '/^+/ { if (/\t/) { print "\tL" NR ":" $0 } }'
+}
+
+printAuthors() {
+ PATCH=$1
+ cat $PATCH | awk '/^+/ { L=tolower($0); if (L ~ /.*\*.* @author/) { print "\tL" NR ":" $0 } }'
+}
+
+printLongLines() {
+ PATCH=$1
+ cat $PATCH | awk '/^+/ { if ( length > 121 ) { print "\tL" NR ":" $0 } }'
+}
+
+if [[ "X$(basename -- "$0")" = "Xraw-check-patch" ]]; then
+ echo Trailing spaces
+ printTrailingSpaces $1
+ echo
+ echo Tabs
+ printTabs $1
+ echo
+ echo Authors
+ printAuthors $1
+ echo
+ echo Long lines
+ printLongLines $1
+fi
Modified: zookeeper/bookkeeper/branches/branch-4.2/bin/test-patch-05-patch-raw-analysis
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/branches/branch-4.2/bin/test-patch-05-patch-raw-analysis?rev=1505180&r1=1505179&r2=1505180&view=diff
==============================================================================
--- zookeeper/bookkeeper/branches/branch-4.2/bin/test-patch-05-patch-raw-analysis (original)
+++ zookeeper/bookkeeper/branches/branch-4.2/bin/test-patch-05-patch-raw-analysis Sat Jul 20 18:18:55 2013
@@ -11,6 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+source $(dirname "$0")/raw-check-patch
if [ "${TESTPATCHDEBUG}" == "true" ] ; then
set -x
@@ -74,37 +75,48 @@ parseArgs() {
}
###############################################################################
checkNoAuthors() {
- authorTags=`grep "^+ " ${PATCHFILE} | grep -c -i -e ".*\*.* @author"`
+ TMPFILE=$TEMPDIR/$TASKNAME-authors.txt
+ printAuthors $PATCHFILE > $TMPFILE
+ authorTags=$(wc -l $TMPFILE | awk '{print $1}')
if [[ ${authorTags} != 0 ]] ; then
REPORT+=("{color:red}-1{color} the patch seems to contain ${authorTags} line(s) with @author tags")
+ REPORT+=("$(cat $TMPFILE)")
else
REPORT+=("{color:green}+1{color} the patch does not introduce any @author tags")
fi
}
###############################################################################
checkNoTabs() {
- tabs=`grep "^+ " ${PATCHFILE} | grep -c -P "\t"`
+ TMPFILE=$TEMPDIR/$TASKNAME-tabs.txt
+ printTabs $PATCHFILE > $TMPFILE
+ tabs=$(wc -l $TMPFILE | awk '{print $1}')
if [[ ${tabs} != 0 ]] ; then
REPORT+=("{color:red}-1{color} the patch contains ${tabs} line(s) with tabs")
+ REPORT+=("$(cat $TMPFILE)")
else
REPORT+=("{color:green}+1{color} the patch does not introduce any tabs")
fi
}
###############################################################################
checkNoTrailingSpaces() {
- trailingSpaces=`grep "^+ " ${PATCHFILE} | grep -c -e " $"`
+ TMPFILE=$TEMPDIR/$TASKNAME-trailingspaces.txt
+ printTrailingSpaces $PATCHFILE > $TMPFILE
+ trailingSpaces=$(wc -l $TMPFILE | awk '{print $1}')
if [[ ${trailingSpaces} != 0 ]] ; then
REPORT+=("{color:red}-1{color} the patch contains ${trailingSpaces} line(s) with trailing spaces")
+ REPORT+=("$(cat $TMPFILE)")
else
REPORT+=("{color:green}+1{color} the patch does not introduce any trailing spaces")
fi
}
###############################################################################
checkLinesLength() {
- # We check for > 120 to account for the "+" sign
- longLines=`grep "^+ " ${PATCHFILE} | awk 'BEGIN{count=0}{if ( length > 121 ) { count=count+1} }END{ print count}'`
+ TMPFILE=$TEMPDIR/$TASKNAME-trailingspaces.txt
+ printLongLines $PATCHFILE > $TMPFILE
+ longLines=$(wc -l $TMPFILE | awk '{print $1}')
if [[ ${longLines} != 0 ]] ; then
REPORT+=("{color:red}-1{color} the patch contains ${longLines} line(s) longer than 120 characters")
+ REPORT+=("$(cat $TMPFILE)")
else
REPORT+=("{color:green}+1{color} the patch does not introduce any line longer than 120")
fi