Files
core/script/lint
T

29 lines
784 B
Bash
Raw Normal View History

2016-02-13 19:56:32 -05:00
#!/bin/sh
# Execute lint to spot code mistakes.
2015-09-17 00:35:26 -07:00
cd "$(dirname "$0")/.."
2018-03-11 16:15:09 -04: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 22:27:39 +02:00
if [ -z "$files" ] ; then
2022-11-23 14:40:37 +01:00
echo "No python file changed.\n"
2018-03-09 22:27:39 +02:00
exit
2016-08-23 05:52:31 +02:00
fi
2018-03-09 22:27:39 +02:00
printf "%s\n" $files
echo "=============="
echo "LINT with ruff"
echo "=============="
pre-commit run ruff --files $files
2018-03-09 22:27:39 +02:00
echo "================"
echo "LINT with pylint"
echo "================"
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 22:27:39 +02:00
echo