-
Notifications
You must be signed in to change notification settings - Fork 0
/
quality.sh
executable file
·61 lines (54 loc) · 1.61 KB
/
quality.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
customDie() {
echo
echo
echo "ERROR:"
echo "$1"
echo
echo
exit 1
}
# pep8-3 says:
# pep8 has been renamed to pycodestyle (GitHub issue #466)
# Use of the pep8 tool will be removed in a future release.
# Please install and use `pycodestyle` instead.
PCS_CMD=pycodestyle-3
if [ ! -f "`command -v pycodestyle-3`" ]; then
pycodestyle_version=`python3 -m pycodestyle --version`
if [ $? -ne 0 ]; then
customDie "pycodestyle-3 is missing ('python3 -m pycodestyle --version' didn't work either). You must first install the python3-pycodestyle package."
else
PCS_CMD="python3 -m pycodestyle"
fi
fi
tmp_path=style-check-output.txt
if [ -f "$tmp_path" ]; then
rm "$tmp_path" || customDie "rm \"$tmp_path\" failed."
fi
echo > "$tmp_path"
# for name in example-cli.py setup.py testing.pyw pypicolcd/lcdframebuffer.py pypicolcd/command_line.py pypicolcd/stats.py pypicolcd/__init__.py
for name in `ls *.py` `ls gcodesynth/*.py`
do
echo "* checking '$name'..."
$PCS_CMD $name >> "$tmp_path"
done
if [ -f "`command -v outputinspector`" ]; then
outputinspector "$tmp_path"
if [ $? -ne 0 ]; then
echo "* \"$tmp_path\" <<END:"
cat "$tmp_path"
echo "END"
echo "(outputinspector failed)"
fi
# rm "$tmp_path"
# sleep 3
else
cat "$tmp_path"
cat <<END
Instead of cat, this script can use outputinspector if you install it
(If you double-click on any error, outputinspector will tell Geany or
Kate to navigate to the line and column in your program):
<https://github.com/poikilos/outputinspector>
END
rm "$tmp_path"
fi