Skip to content

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

basak-qcom
Copy link
Contributor

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.

@basak-qcom basak-qcom force-pushed the comprehensive-static-checks branch 2 times, most recently from e4feba5 to f7c1cf7 Compare July 2, 2025 15:51
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]>
@basak-qcom basak-qcom force-pushed the comprehensive-static-checks branch from f7c1cf7 to 61f8546 Compare July 2, 2025 15:56
@basak-qcom
Copy link
Contributor Author

pylint wants the imports from ci/schemacheck.py but these are only available from container: lavasoftware/lava-server:2025.04. I'm not sure how to handle this. We could exclude this file explicitly, or test it separately, or tune pylint somehow.

Copy link

github-actions bot commented Jul 2, 2025

Test Results

 2 files  ±0   4 suites  ±0   5m 44s ⏱️ ±0s
15 tests ±0  15 ✅ ±0  0 💤 ±0  0 ❌ ±0 
38 runs  ±0  38 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit 61f8546. ± Comparison against base commit a5d8176.

Copy link

github-actions bot commented Jul 2, 2025

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"' -- | \
Copy link
Contributor

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!

Copy link
Contributor Author

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?

Copy link
Contributor Author

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!)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

scan-files?

@basak-qcom basak-qcom self-assigned this Jul 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants