manila/tools/check_logging.sh
Goutham Pacha Ravi 6f79bb6c89 Fix URLs in code and documentation
TrivialFix

Change-Id: I21863f7fdad2bdd5dee226a3f6872d25b1c4f8ad
Signed-off-by: Goutham Pacha Ravi <gouthampravi@gmail.com>
2020-03-18 18:59:27 -07:00

25 lines
429 B
Bash
Executable File

#!/bin/bash
tree=$1
tmpfile=$(mktemp)
find $tree -name '*.py' \
| xargs grep -l 'import log' \
| xargs grep -l '^LOG =' \
| xargs grep -c 'LOG' \
| grep ':1$' \
| awk -F ':' '{print $1}' > $tmpfile
count=$(wc -l < $tmpfile)
if [[ count -eq 0 ]]; then
rm $tmpfile
exit 0
fi
echo 'Found files with unused LOG variable (see https://review.opendev.org/#/c/301054):'
cat $tmpfile
rm $tmpfile
exit 1