Add pylint to Python coding style checks
Runs pylint -E (only highlights errors) as part of
test-codingstyle-py.sh.
pushd $(dirname $0)/..
PYCODESTYLE=$(which pycodestyle)
-FILES=$(find . -iname "*.py")
+PYLINT=$(which pylint)
+FILES=$(find . -iname "*.py" -not -name "cpplint.py")
FILES+=" "
-FILES+=$(grep -rl "^#./usr/bin.*python" ./*)
+FILES+=$(grep -rl "^#./usr/bin.*python" ./* | grep -v cpplint.py)
+
+if [ ! -x "$PYLINT" ]; then
+ echo "no pylint"
+ popd
+ exit 1
+fi
if [ ! -x "$PYCODESTYLE" ]; then
echo "no pycodestyle"
@@ -13,15 +20,22 @@ if [ ! -x "$PYCODESTYLE" ]; then
exit 1
fi
+echo -e "\n===== pycodestyle ====="
$PYCODESTYLE $FILES
+if [ $? -ne 0 ]; then
+ echo "test-codingstyle-py FAILED"
+ popd
+ exit 1
+fi
-if [ $? -eq 1 ]; then
+echo -e "\n===== pylint -E ====="
+$PYLINT -E -f parseable $FILES
+if [ $? -ne 0 ]; then
echo "test-codingstyle-py FAILED"
popd
exit 1
-else
+fi
+
echo "test-codingstyle-py PASSED"
popd
exit 0
\ No newline at end of file
-fi
-
