updated on Wed Jan 18 04:00:29 UTC 2012
[aur-mirror.git] / pmd / cpd
blob8626d0214a0c6076532e3c5c4d7c66b9b5ddd3a2
1 #!/bin/sh
3 ## This will work in the majority of shells out there...
5 ## This will parse a directory named on the command line and produce a
6 ## cut and paste report for c++ files in that directory (or 'c', if you
7 ## set the environment variable LANGUAGE to 'c').
9 ## Note that other rules are only for Java code not C source.
11 ## If you run into java.lang.OutOfMemoryError, try setting the environment
12 ## variable HEAPSIZE to e.g. 512m
14 if [ -z "$1" ]; then
15 script=`basename $0`
16 echo "Usage:"
17 echo " $script <directory>"
18 exit 1
21 DIRECTORY=$1
23 for name in /usr/share/java/pmd/*.jar; do
24 CP=$CP:$name
25 done
27 HEAPSIZE=${HEAPSIZE:-512m}
28 LANGUAGE=${LANGUAGE:-cpp}
29 MINIMUM_TOKENS=${MINIMUM_TOKENS:-100}
31 case "$HEAPSIZE" in
32 [1-9]*[mgMG]) HEAPSIZE=-Xmx$HEAPSIZE ;;
33 '') ;;
34 *) echo "HEAPSIZE '$HEAPSIZE' unknown (try: 512m)"
35 exit 1
36 esac
38 case "$LANGUAGE" in
39 c|cpp|fortran|java|jsp|php|ruby) ;;
40 *) echo "Language '$LANGUAGE' unknown (try: c, cpp, fortran, java, jsp, php, ruby)"
41 exit 1
42 esac
44 $JAVA_HOME/bin/java $HEAPSIZE -cp $CP net.sourceforge.pmd.cpd.CPD --minimum-tokens $MINIMUM_TOKENS --files $DIRECTORY --language $LANGUAGE