summaryrefslogtreecommitdiffstats
path: root/check_java_packages
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2017-09-28 11:53:11 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2017-09-28 11:53:11 +0200
commitfeb46495ebba27980fd234ef0fe09ee88f87723c (patch)
treea96f5ebaa13a26b3db65738c75db0e759714cc0a /check_java_packages
parente2869cfe4215cc27f2c04ebf8cd26ee1abbd36dc (diff)
downloadbin-feb46495ebba27980fd234ef0fe09ee88f87723c.zip
bin-feb46495ebba27980fd234ef0fe09ee88f87723c.tar.gz
check_java_packages : imporve output
Diffstat (limited to 'check_java_packages')
-rwxr-xr-xcheck_java_packages10
1 files changed, 6 insertions, 4 deletions
diff --git a/check_java_packages b/check_java_packages
index 1b9b5f8..d12f4fb 100755
--- a/check_java_packages
+++ b/check_java_packages
@@ -13,9 +13,10 @@ RED="\033[0;31m"
BROWN="\033[0;33m"
GREEN="\033[0;32m"
-cd $TOPDIR
-find . -name *.java | while read file; do
- CORRECT=$(echo $file | sed 's/\.\///; s/\/\+/\./g; s/\.\w\+.java//')
+find $TOPDIR -name *.java | while read file;
+do
+ relpath=${file#${TOPDIR}}
+ CORRECT=$(echo $relpath | sed 's/\.\///; s/\/\+/\./g; s/\.\w\+.java//')
N=$(cat $file | grep package | wc -l)
if [ $N -gt 1 ]; then
echo -e "$file : $BROWN more then 1 package directive$RESET";
@@ -33,7 +34,8 @@ find . -name *.java | while read file; do
echo -e "$file : $RED$PACKAGE$RESET -> $GREEN$CORRECT$RESET";
touch $ERRORS
fi
- for IMPORT in $(cat $file | sed -n 's/import\s\+.*\.\(.*\);/\1/p'); do
+ for IMPORT in $(cat $file | sed -n 's/import\s\+.*\.\(.*\);/\1/p');
+ do
cat $file | grep $IMPORT | grep -qv import
if [ $? -ne 0 ]; then
echo -e "$file : import $RED$IMPORT$RESET might be useless";