You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by emerson cargnin <ec...@gmail.com> on 2007/02/28 12:17:14 UTC

Excluding packages from checkstyle check

Hi there, I'm using a subversion pre-commit hook and checkstyle to
check style during commit.

Does anyone know how can i filter out some packages to not be checked?
I presume i need to change the line:
FILE=`echo $LINE | egrep \\.java$`


I use the following script:

# Run checkstyle on java files
CHANGED=`$SVNLOOK changed -t "$TXN" "$REPOS" | grep -v "^D" |\
        awk '{print $2}'`
mkdir -p $TMPDIR
X=0
for LINE in $CHANGED  ; do
   FILE=`echo $LINE | egrep \\.java$`
   if [ -n "$FILE" ] ; then
       $SVNLOOK cat $REPOS --transaction $TXN $FILE > $TMPDIR/tmpfile.java
       $JAVA -jar $CHECKSTYLE -c $CHECKSTYLE_CONFIG $TMPDIR/tmpfile.java \
           > $TMPDIR/tmpfile.checkstyle
       X=$(($X + $?))
       cat $TMPDIR/tmpfile.checkstyle |\
           grep -v "^Starting audit...$\|^Audit done.$" |\
           sed -e "s@$TMPDIR/tmpfile.java@$FILE@" \
           >> $REPORT
       fi
done
if [ $X -ne 0 ] ; then
   cat $REPORT > /dev/stderr
   rm -Rf $TMPDIR
   exit 1
fi
rm -Rf $TMPDIR

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org