summaryrefslogtreecommitdiffstats
path: root/check_java_packages
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2017-04-24 15:48:53 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2017-04-24 15:48:53 +0200
commit70ba9f13b3ac6f95269fcd78b16e4c50d476ec0b (patch)
tree62d9442c7d6adebfed5fe9969464e28ef3e5172c /check_java_packages
parent761213bdf255c22ba68ca6f2daa2b2e82f51a591 (diff)
downloadbin-70ba9f13b3ac6f95269fcd78b16e4c50d476ec0b.zip
bin-70ba9f13b3ac6f95269fcd78b16e4c50d476ec0b.tar.gz
check_java_packages : check for unused impont statements too
Diffstat (limited to 'check_java_packages')
-rwxr-xr-xcheck_java_packages6
1 files changed, 6 insertions, 0 deletions
diff --git a/check_java_packages b/check_java_packages
index f90e520..1b9b5f8 100755
--- a/check_java_packages
+++ b/check_java_packages
@@ -33,6 +33,12 @@ 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
+ cat $file | grep $IMPORT | grep -qv import
+ if [ $? -ne 0 ]; then
+ echo -e "$file : import $RED$IMPORT$RESET might be useless";
+ fi
+ done
done
if [ -r "$ERRORS" ]; then