From 70ba9f13b3ac6f95269fcd78b16e4c50d476ec0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Mon, 24 Apr 2017 15:48:53 +0200 Subject: check_java_packages : check for unused impont statements too --- check_java_packages | 6 ++++++ 1 file changed, 6 insertions(+) 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 -- cgit v1.1-2-g2b99