2020-02-10 12:29:30 -08:00
|
|
|
#!/bin/sh
|
|
|
|
if [ ! -f "`command -v pycodestyle-3`" ]; then
|
2020-04-29 14:08:07 -07:00
|
|
|
echo "You must install the python3-pycodestyle package before using the quality script."
|
|
|
|
exit 1
|
2020-02-10 12:29:30 -08:00
|
|
|
fi
|
|
|
|
# target="__init__.py"
|
|
|
|
# if [ ! -z "$1" ]; then
|
2020-04-29 14:08:07 -07:00
|
|
|
# target="$1"
|
2020-02-10 12:29:30 -08:00
|
|
|
# fi
|
|
|
|
if [ -f err.txt ]; then
|
2020-04-29 14:08:07 -07:00
|
|
|
rm err.txt
|
2020-02-10 12:29:30 -08:00
|
|
|
fi
|
2020-04-29 14:08:07 -07:00
|
|
|
ext="py"
|
2020-02-10 12:29:30 -08:00
|
|
|
if [ -f "`command -v outputinspector`" ]; then
|
2020-04-29 14:08:07 -07:00
|
|
|
for f in *.$ext; do
|
|
|
|
pycodestyle-3 "$f" >> err.txt
|
|
|
|
done
|
|
|
|
# For one-liner, would use `||` not `&&`, because pycodestyle-3 returns nonzero (error state) if there are any errors
|
|
|
|
if [ -s "err.txt" ]; then
|
|
|
|
# -s: exists and >0 bytes
|
|
|
|
outputinspector
|
|
|
|
else
|
|
|
|
echo "No quality issues were detected."
|
|
|
|
rm err.txt
|
|
|
|
# echo "Deleted empty 'err.txt'."
|
|
|
|
fi
|
2020-02-10 12:29:30 -08:00
|
|
|
else
|
2020-04-29 14:08:07 -07:00
|
|
|
for f in *.$ext; do
|
|
|
|
pycodestyle-3 "$f" >> err.txt
|
|
|
|
done
|
|
|
|
echo
|
|
|
|
echo "If you install outputinspector, this output can be examined automatically, allowing double-click to skip to line in Geany/Kate"
|
|
|
|
echo
|
2020-02-10 12:29:30 -08:00
|
|
|
fi
|