1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-16 09:10:35 +03:00

Try A_D's "diff only" flake8 checking

This commit is contained in:
Athanasius 2020-07-26 20:45:08 +01:00
parent 838e55710d
commit f41eb4fb92

View File

@ -26,8 +26,25 @@ jobs:
pip install flake8 pytest
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi
- name: Lint with flake8
env:
ROOT_SHA: ${{github.base_ref}}
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
DATA=$(python3 <<EOF
import json
import os
with open(os.getenv('GITHUB_EVENT_PATH')) as f:
data = json.load(f)
typ = os.getenv('GITHUB_EVENT_NAME')
if 'pull_request' in typ:
print(data['base']['ref'])
elif 'push' in typ:
print(data['before'])
EOF
)
# stop the build if there are Python syntax errors or undefined names, ignore existing
git diff "$DATA" | flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --diff
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
git diff "$DATA" | flake8 . --count --exit-zero --statistics --diff