ports/99907: [NEW PORT] devel/pmd: Static analysis tool for Java source code
Alex Varju
freebsd-ports at varju.ca
Sat Jul 8 08:00:49 UTC 2006
>Number: 99907
>Category: ports
>Synopsis: [NEW PORT] devel/pmd: Static analysis tool for Java source code
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Sat Jul 08 08:00:47 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator: Alex Varju
>Release: FreeBSD 5.3-STABLE i386
>Organization:
>Environment:
System: FreeBSD snapple.webct.com 5.3-STABLE FreeBSD 5.3-STABLE #13: Wed Nov 3 11:31:28 PST
>Description:
PMD scans Java source code and looks for potential problems like:
* Possible bugs - empty try/catch/finally/switch statements
* Dead code - unused local variables, parameters and private methods
* Suboptimal code - wasteful String/StringBuffer usage
* Overcomplicated expressions - unnecessary if statements, for loops
that could be while loops
* Duplicate code - copied/pasted code means copied/pasted bugs
WWW: http://pmd.sourceforge.net/
Generated with FreeBSD Port Tools 0.77
>How-To-Repeat:
>Fix:
--- pmd-3.7.shar begins here ---
# This is a shell archive. Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file". Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
# pmd
# pmd/files
# pmd/files/patch-bin::bgastviewer.sh
# pmd/files/patch-bin::cpd.sh
# pmd/files/patch-bin::pmd.sh
# pmd/files/patch-bin::designer.sh
# pmd/Makefile
# pmd/distinfo
# pmd/pkg-plist
# pmd/pkg-descr
#
echo c - pmd
mkdir -p pmd > /dev/null 2>&1
echo c - pmd/files
mkdir -p pmd/files > /dev/null 2>&1
echo x - pmd/files/patch-bin::bgastviewer.sh
sed 's/^X//' >pmd/files/patch-bin::bgastviewer.sh << 'END-of-pmd/files/patch-bin::bgastviewer.sh'
X--- bin/bgastviewer.sh.orig Fri May 26 05:37:58 2006
X+++ bin/bgastviewer.sh Fri Jul 7 21:46:32 2006
X@@ -1 +1,9 @@
X-java -cp ../build:../lib/jakarta-oro-2.0.8.jar:../lib/pmd-3.7.jar:../lib/xercesImpl-2.6.2.jar:../lib/xmlParserAPIs-2.6.2.jar:../lib/jaxen-1.1-beta-7.jar net.sourceforge.pmd.util.viewer.Viewer
X+#!/bin/sh
X+
X+JARS=`/bin/ls -1 JAVAJARDIR/pmd/*jar`
X+CLASSPATH=""
X+for jar in $JARS; do
X+ CLASSPATH="$CLASSPATH:$jar"
X+done
X+
X+java -cp $CLASSPATH net.sourceforge.pmd.util.viewer.Viewer
END-of-pmd/files/patch-bin::bgastviewer.sh
echo x - pmd/files/patch-bin::cpd.sh
sed 's/^X//' >pmd/files/patch-bin::cpd.sh << 'END-of-pmd/files/patch-bin::cpd.sh'
X--- bin/cpd.sh.orig Sat Jul 8 00:08:24 2006
X+++ bin/cpd.sh Sat Jul 8 00:12:41 2006
X@@ -20,26 +20,8 @@
X exit 1
X fi
X
X-
X-SCRIPT_DIR=`dirname $0`
X-CWD="$PWD"
X-
X-cd "$SCRIPT_DIR/../lib"
X-LIB_DIR=`pwd -P`
X-
X classpath=$CLASSPATH
X-
X-build_dir="$SCRIPT_DIR/../build"
X-
X-if [ -d "$build_dir" ]; then
X- cd "$build_dir"
X- build_dir=`pwd -P`
X- classpath=$classpath:$build_dir
X-fi
X-
X-cd "$CWD"
X-
X-for jarfile in `ls $LIB_DIR/*.jar`; do
X+for jarfile in `ls JAVAJARDIR/pmd/*.jar`; do
X classpath=$classpath:$jarfile
X done
X
END-of-pmd/files/patch-bin::cpd.sh
echo x - pmd/files/patch-bin::pmd.sh
sed 's/^X//' >pmd/files/patch-bin::pmd.sh << 'END-of-pmd/files/patch-bin::pmd.sh'
X--- bin/pmd.sh.orig Sat Jul 8 00:08:24 2006
X+++ bin/pmd.sh Sat Jul 8 00:14:39 2006
X@@ -7,25 +7,8 @@
X exit 1
X fi
X
X-SCRIPT_DIR=`dirname $0`
X-CWD="$PWD"
X-
X-cd "$SCRIPT_DIR/../lib"
X-LIB_DIR=`pwd -P`
X-
X classpath=$CLASSPATH
X-
X-build_dir="$SCRIPT_DIR/../build"
X-
X-if [ -d "$build_dir" ]; then
X- cd "$build_dir"
X- build_dir=`pwd -P`
X- classpath=$classpath:$build_dir
X-fi
X-
X-cd "$CWD"
X-
X-for jarfile in `ls $LIB_DIR/*.jar`; do
X+for jarfile in `ls JAVAJARDIR/pmd/*.jar`; do
X classpath=$classpath:$jarfile
X done
X
END-of-pmd/files/patch-bin::pmd.sh
echo x - pmd/files/patch-bin::designer.sh
sed 's/^X//' >pmd/files/patch-bin::designer.sh << 'END-of-pmd/files/patch-bin::designer.sh'
X--- bin/designer.sh.bak Fri Jan 28 08:13:49 2005
X+++ bin/designer.sh Sat Jul 8 00:15:27 2006
X@@ -1,24 +1,7 @@
X #!/bin/bash
X
X-SCRIPT_DIR=`dirname $0`
X-CWD="$PWD"
X-
X-cd "$SCRIPT_DIR/../lib"
X-LIB_DIR=`pwd -P`
X-
X classpath=$CLASSPATH
X-
X-build_dir="$SCRIPT_DIR/../build"
X-
X-if [ -d "$build_dir" ]; then
X- cd "$build_dir"
X- build_dir=`pwd -P`
X- classpath=$classpath:$build_dir
X-fi
X-
X-cd "$CWD"
X-
X-for jarfile in `ls $LIB_DIR/*.jar`; do
X+for jarfile in `ls JAVAJARDIR/pmd/*.jar`; do
X classpath=$classpath:$jarfile
X done
X
END-of-pmd/files/patch-bin::designer.sh
echo x - pmd/Makefile
sed 's/^X//' >pmd/Makefile << 'END-of-pmd/Makefile'
X# New ports collection makefile for: pmd
X# Date created: 2006-06-07
X# Whom: Alex Varju <freebsd-ports at varju.ca>
X#
X# $FreeBSD$
X#
X
XPORTNAME= pmd
XPORTVERSION= 3.7
XCATEGORIES= devel java
XMASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
XMASTER_SITE_SUBDIR= pmd
XDISTNAME= ${PORTNAME}-src-${PORTVERSION}
X
XMAINTAINER= freebsd-ports at varju.ca
XCOMMENT= Static analysis tool for Java source code
X
XBUILD_DEPENDS= ${JAVALIBDIR}/junit.jar:${PORTSDIR}/java/junit
X
XUSE_ZIP= yes
XUSE_JAVA= yes
XUSE_ANT= yes
X
XMAKE_ARGS= -cp ${JAVALIBDIR}/junit.jar
X
X.include <bsd.port.pre.mk>
X
XWRKSRC= ${WRKDIR}/${PORTNAME}-${PORTVERSION}
XBUILD_WRKSRC= ${WRKSRC}/bin
X
X.if !defined(NOPORTDOCS)
XPORTDOCS= *
X.endif
X
Xdo-install:
X.for script in bgastviewer.sh cpd.sh designer.sh pmd.sh
X ${REINPLACE_CMD} -e "s|JAVAJARDIR|${JAVAJARDIR}|" ${INSTALL_WRKSRC}/bin/${script}
X.endfor
X ${INSTALL_SCRIPT} ${INSTALL_WRKSRC}/bin/bgastviewer.sh ${PREFIX}/bin/bgastviewer
X ${INSTALL_SCRIPT} ${INSTALL_WRKSRC}/bin/cpd.sh ${PREFIX}/bin/cpd
X ${INSTALL_SCRIPT} ${INSTALL_WRKSRC}/bin/designer.sh ${PREFIX}/bin/pmd_designer
X ${INSTALL_SCRIPT} ${INSTALL_WRKSRC}/bin/pmd.sh ${PREFIX}/bin/pmd
X ${MKDIR} ${JAVAJARDIR}/pmd
X cd ${INSTALL_WRKSRC}/lib \
X && ${FIND} . -type f -exec ${INSTALL_DATA} \{} ${JAVAJARDIR}/pmd/ \;
X.if !defined(NOPORTDOCS)
X cd ${INSTALL_WRKSRC}/docs \
X && ${FIND} . -type d -exec ${MKDIR} ${DOCSDIR}/\{} \; \
X && ${FIND} . -type f -exec ${INSTALL_DATA} \{} ${DOCSDIR}/\{} \;
X.endif
X
X.include <bsd.port.post.mk>
END-of-pmd/Makefile
echo x - pmd/distinfo
sed 's/^X//' >pmd/distinfo << 'END-of-pmd/distinfo'
XMD5 (pmd-src-3.7.zip) = 0d4390017f2467345ca7b91b1437fef9
XSHA256 (pmd-src-3.7.zip) = a35de76cd8049fd91b3c4e2031b7b03f849e03e2facba1e32ea1cb27cacdb5ff
XSIZE (pmd-src-3.7.zip) = 10756798
END-of-pmd/distinfo
echo x - pmd/pkg-plist
sed 's/^X//' >pmd/pkg-plist << 'END-of-pmd/pkg-plist'
Xbin/bgastviewer
Xbin/cpd
Xbin/pmd
Xbin/pmd_designer
Xshare/java/classes/pmd/jakarta-oro-2.0.8.jar
Xshare/java/classes/pmd/jaxen-1.1-beta-7.jar
Xshare/java/classes/pmd/pmd-3.7.jar
Xshare/java/classes/pmd/pmd-src-3.7.jar
Xshare/java/classes/pmd/xercesImpl-2.6.2.jar
Xshare/java/classes/pmd/xmlParserAPIs-2.6.2.jar
X at dirrm share/java/classes/pmd
END-of-pmd/pkg-plist
echo x - pmd/pkg-descr
sed 's/^X//' >pmd/pkg-descr << 'END-of-pmd/pkg-descr'
XPMD scans Java source code and looks for potential problems like:
X
X * Possible bugs - empty try/catch/finally/switch statements
X * Dead code - unused local variables, parameters and private methods
X * Suboptimal code - wasteful String/StringBuffer usage
X * Overcomplicated expressions - unnecessary if statements, for loops
X that could be while loops
X * Duplicate code - copied/pasted code means copied/pasted bugs
X
XWWW: http://pmd.sourceforge.net/
END-of-pmd/pkg-descr
exit
--- pmd-3.7.shar ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list