2016-04-04 07:01:28 -04:00
|
|
|
#!/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
|
|
|
|
|
2020-03-18 18:59:27 -07:00
|
|
|
echo 'Found files with unused LOG variable (see https://review.opendev.org/#/c/301054):'
|
2016-04-04 07:01:28 -04:00
|
|
|
cat $tmpfile
|
|
|
|
rm $tmpfile
|
|
|
|
exit 1
|