init home-assistant
This commit is contained in:
28
home-assistant/script/lint
Executable file
28
home-assistant/script/lint
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/bin/sh
|
||||
# Execute lint to spot code mistakes.
|
||||
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
export files="$(git diff $(git merge-base upstream/dev HEAD) --diff-filter=d --name-only | grep -e '\.py$')"
|
||||
echo '================================================='
|
||||
echo '= FILES CHANGED ='
|
||||
echo '================================================='
|
||||
if [ -z "$files" ] ; then
|
||||
echo "No python file changed.\n"
|
||||
exit
|
||||
fi
|
||||
printf "%s\n" $files
|
||||
echo "=============="
|
||||
echo "LINT with ruff"
|
||||
echo "=============="
|
||||
pre-commit run ruff --files $files
|
||||
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
|
||||
echo
|
||||
Reference in New Issue
Block a user