Skip to content

Commit a2441a3

Browse files
committed
CI: scan all Python scripts
Now that commit b1781ef established a pattern to find all shell scripts for linting, do the same for all Python scripts. This way, adding a file anywhere in the repository will be sufficient to ensure it is scanned, instead of hoping that we remember to amend the lint invocations. Signed-off-by: Robie Basak <[email protected]>
1 parent a5d8176 commit a2441a3

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

.github/workflows/static-checks.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,12 @@ jobs:
3030
fetch-depth: 0
3131

3232
- name: Run Flake8
33-
run: flake8 scripts/*.py
33+
run:
34+
# Run flake8 against all files outside .git/ that `file` reports
35+
# as text/x-script.python
36+
find . -path ./.git -prune -o -print0 | \
37+
xargs -0n1 sh -c 'test "$(file --brief --mime-type "$1")" = "text/x-script.python" && printf "%s\000" "$1"' -- | \
38+
xargs -0t flake8
3439

3540
pylint:
3641
name: Install and run Pylint on Python scripts
@@ -44,7 +49,12 @@ jobs:
4449
fetch-depth: 0
4550

4651
- name: Run Pylint (error mode)
47-
run: pylint --errors-only scripts/*.py
52+
run:
53+
# Run pylint against all files outside .git/ that `file` reports
54+
# as text/x-script.python
55+
find . -path ./.git -prune -o -print0 | \
56+
xargs -0n1 sh -c 'test "$(file --brief --mime-type "$1")" = "text/x-script.python" && printf "%s\000" "$1"' -- | \
57+
xargs -0t pylint --errors-only
4858

4959
shellcheck:
5060
name: Install and run ShellCheck on shell scripts

0 commit comments

Comments
 (0)