-
Notifications
You must be signed in to change notification settings - Fork 12
CI: scan all Python scripts #92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
CI: scan all Python scripts #92
Conversation
e4feba5
to
f7c1cf7
Compare
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]>
f7c1cf7
to
61f8546
Compare
pylint wants the imports from |
Test jobs for commit 61f8546 |
# Run flake8 against all files outside .git/ that `file` reports | ||
# as text/x-script.python | ||
find . -path ./.git -prune -o -print0 | \ | ||
xargs -0n1 sh -c 'test "$(file --brief --mime-type "$1")" = "text/x-script.python" && printf "%s\000" "$1"' -- | \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find this hard to parse, but I know it's copy-pasted from the other implementation; could we have "search for files with this MIME type" somewhere and use this so that it's at least in a single place and each action can be kept simple?
I kind of regret the simplicity of *.py!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to do that too. Where should it go? Under scripts/
, to be sourced by each of these jobs perhaps? Then it would look like:
run: |
. scripts/functions
for_each_mime_type text/x-script.python flake8
Would this be acceptable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(suggestions for a better name than for_each_mime_type
appreciated!)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
scan-files?
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.