mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-06-10 04:12:15 +03:00
Try A_D's "diff only" flake8 checking
This commit is contained in:
parent
838e55710d
commit
f41eb4fb92
23
.github/workflows/python-app.yml
vendored
23
.github/workflows/python-app.yml
vendored
@ -26,8 +26,25 @@ jobs:
|
|||||||
pip install flake8 pytest
|
pip install flake8 pytest
|
||||||
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi
|
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi
|
||||||
- name: Lint with flake8
|
- name: Lint with flake8
|
||||||
|
env:
|
||||||
|
ROOT_SHA: ${{github.base_ref}}
|
||||||
|
|
||||||
run: |
|
run: |
|
||||||
# stop the build if there are Python syntax errors or undefined names
|
DATA=$(python3 <<EOF
|
||||||
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
|
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
|
# 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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user