2016-02-14 00:56:32 +00:00
|
|
|
#!/bin/sh
|
2017-01-02 21:04:09 +00:00
|
|
|
# Execute lint to spot code mistakes.
|
2015-09-17 07:35:26 +00:00
|
|
|
|
2017-01-05 08:45:14 +00:00
|
|
|
cd "$(dirname "$0")/.."
|
|
|
|
|
2018-03-11 20:15:09 +00:00
|
|
|
export files="$(git diff $(git merge-base upstream/dev HEAD) --diff-filter=d --name-only | grep -e '\.py$')"
|
|
|
|
echo '================================================='
|
|
|
|
echo '= FILES CHANGED ='
|
|
|
|
echo '================================================='
|
2018-03-09 20:27:39 +00:00
|
|
|
if [ -z "$files" ] ; then
|
2022-11-23 13:40:37 +00:00
|
|
|
echo "No python file changed.\n"
|
2018-03-09 20:27:39 +00:00
|
|
|
exit
|
2016-08-23 03:52:31 +00:00
|
|
|
fi
|
2018-03-09 20:27:39 +00:00
|
|
|
printf "%s\n" $files
|
2023-01-24 11:15:16 +00:00
|
|
|
echo "=============="
|
|
|
|
echo "LINT with ruff"
|
|
|
|
echo "=============="
|
|
|
|
pre-commit run ruff --files $files
|
2018-03-09 20:27:39 +00:00
|
|
|
echo "================"
|
|
|
|
echo "LINT with pylint"
|
|
|
|
echo "================"
|
2018-05-10 10:47:04 +00:00
|
|
|
pylint_files=$(echo "$files" | grep -v '^tests.*')
|
|
|
|
if [ -z "$pylint_files" ] ; then
|
|
|
|
echo "Only test files changed. Skipping\n"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
pylint $pylint_files
|
2018-03-09 20:27:39 +00:00
|
|
|
echo
|