File: lint

package info (click to toggle)
python-aioharmony 0.2.10-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 308 kB
  • sloc: python: 2,587; sh: 24; makefile: 13
file content (28 lines) | stat: -rwxr-xr-x 802 bytes parent folder | download
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
#!/bin/sh
# Execute lint to spot code mistakes.

cd "$(dirname "$0")/.."

export files="$(git diff $(git merge-base origin/dev HEAD) --diff-filter=d --name-only | grep -e '\.py$')"
echo '================================================='
echo '=                FILES CHANGED                  ='
echo '================================================='
if [ -z "$files" ] ; then
  echo "No python file changed. Rather use: tox -e lint\n"
  exit
fi
printf "%s\n" $files
echo "================"
echo "LINT with flake8"
echo "================"
flake8 --doctests $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