Skip to content

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 3 times, most recently 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.

@github-actions
Copy link

github-actions bot commented Jul 2, 2025

Test Results

 2 files  ±0   6 suites  ±0   10m 11s ⏱️ + 1m 50s
20 tests ±0  20 ✅ ±0  0 💤 ±0  0 ❌ ±0 
64 runs  ±0  64 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit 994439b. ± Comparison against base commit 28e463b.

♻️ This comment has been updated with latest results.

@github-actions
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
@basak-qcom
Copy link
Contributor Author

Making this a draft while I test iterations against actual CI.

@basak-qcom basak-qcom marked this pull request as draft September 24, 2025 14:40
@basak-qcom basak-qcom force-pushed the comprehensive-static-checks branch from 61f8546 to 2b82e91 Compare September 24, 2025 14:41
basak-qcom and others added 2 commits September 24, 2025 16:15
We're already using pylint in CI against this repository, but it
currently does not cover this file by accident. To fix that, ideally
this file would comply with our CI policy on everything being pylint
clean.

However, it's difficult currently with our GitHub workflow arrangements
to ensure that all imports for all scripts are available at the time
pylint runs. Since there are only two instances of this in the entire
repository, just skip these two specific import checks for now.

I would like to move these checks so they run locally as well with "make
check", at which point we'd switch the GitHub workflows to doing that
instead, and then everything would be aligned including a single place
to define development dependencies. However, these dependencies are not
currently available as packages, so it seems too much to expect
developers to manage at the moment. That's a rabbithole, so for now, to
make progress, skipping these for the sake of two ignore directives
seems like a reasonable compromise.

Signed-off-by: Robie Basak <[email protected]>
Now that commit b1781ef established a pattern to find all shell scripts
for linting, do the same for all Python scripts, refactoring the pattern
out into a reusable shell function.

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 324e04b to 994439b Compare September 24, 2025 15:17
@github-actions
Copy link

Test jobs for commit 994439b

@basak-qcom
Copy link
Contributor Author

I think this is ready to land now. I've addressed all review points.

@basak-qcom basak-qcom marked this pull request as ready for review September 24, 2025 16:32
Copy link
Contributor

@lool lool left a comment

Choose a reason for hiding this comment

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

Quick thoughts:

  1. I think a shell script rather than function would have prevented the need to have special shellcheck excludes, I'm ok with a function though

  2. I now realize there are global static analysis efforts across all Qualcomm repos; perhaps it is worth seeing if we could leverage these and sending our contributions if they are not good enough, rather than maintain our own sauce

Perhaps we should have make check cover the code that people are expected to use, including local static analysis, and the Qualcomm workflows scan all code especially workflow related files

@lool lool merged commit 3e8ce39 into qualcomm-linux:main Sep 24, 2025
13 checks passed
@lool
Copy link
Contributor

lool commented Sep 24, 2025

Quick thoughts:

  1. I think a shell script rather than function would have prevented the need to have special shellcheck excludes, I'm ok with a function though
  2. I now realize there are global static analysis efforts across all Qualcomm repos; perhaps it is worth seeing if we could leverage these and sending our contributions if they are not good enough, rather than maintain our own sauce

Perhaps we should have make check cover the code that people are expected to use, including local static analysis, and the Qualcomm workflows scan all code especially workflow related files

See https://github.com/qualcomm/qcom-actions/blob/main/README.md for global workflows – there might be others, I think there's also a GitHub or CodeScan tool running somewhere as well.

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