mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-12 15:27:14 +03:00
github/pr-/push-checks: Attempt non-diff flake8 checks
* flake8 6.0.0 dropped support for, the broken, --diff. * We want to only run against python files. We will have 'git diff's for other types of files. * Uses 'git diff -z', 'grep -z -Z' and 'xargs -0' so as to pass NUL-terminated strings around to avoid "special characters in path/filenames" issues.
This commit is contained in:
parent
514f3fac8a
commit
8628efa0a1
8
.github/workflows/pr-checks.yml
vendored
8
.github/workflows/pr-checks.yml
vendored
@ -85,11 +85,15 @@ jobs:
|
||||
# F63 - 'tests' checking
|
||||
# F7 - syntax errors
|
||||
# F82 - undefined checking
|
||||
git diff "refs/remotes/${BASE_REPO_OWNER}/${BASE_REF}" -- | flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --diff
|
||||
echo git diff --name-only --diff-filter=d -z "refs/remotes/${BASE_REPO_OWNER}/${BASE_REF}" -- | \
|
||||
grep -E -z -Z '\.py$' | \
|
||||
xargs -0 flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
|
||||
# Can optionally add `--exit-zero` to the flake8 arguments so that
|
||||
# this doesn't fail the build.
|
||||
# explicitly ignore docstring errors (start with D)
|
||||
git diff "refs/remotes/${BASE_REPO_OWNER}/${BASE_REF}" -- | flake8 . --count --statistics --diff --extend-ignore D
|
||||
git diff --name-only --diff-filter=d -z "refs/remotes/${BASE_REPO_OWNER}/${BASE_REF}" -- | \
|
||||
grep -E -z -Z '\.py$' | \
|
||||
xargs -0 flake8 . --count --statistics --extend-ignore D
|
||||
####################################################################
|
||||
|
||||
####################################################################
|
||||
|
17
.github/workflows/push-checks.yml
vendored
17
.github/workflows/push-checks.yml
vendored
@ -40,7 +40,20 @@ jobs:
|
||||
DATA=$(jq --raw-output .before $GITHUB_EVENT_PATH)
|
||||
|
||||
echo "DATA: ${DATA}"
|
||||
#######################################################################
|
||||
# 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
|
||||
#######################################################################
|
||||
# We need to get just the *filenames* of only *python* files changed.
|
||||
# Using various -z/-Z/-0 to utilise NUL-terminated strings.
|
||||
git diff --name-only --diff-filter=d -z "$DATA" | \
|
||||
grep -E -z -Z '\.py$' | \
|
||||
xargs -0 flake8 --count --select=E9,F63,F7,F82 --show-source --statistics
|
||||
#######################################################################
|
||||
|
||||
#######################################################################
|
||||
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
|
||||
git diff "$DATA" | flake8 . --count --statistics --diff
|
||||
#######################################################################
|
||||
git diff --name-only --diff-filter=d -z "$DATA" | \
|
||||
grep -E -z -Z '\.py$' | \
|
||||
xargs -0 flake8 . --count --statistics
|
||||
#######################################################################
|
||||
|
Loading…
x
Reference in New Issue
Block a user