-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
ci/lint: add python linting #14848
ci/lint: add python linting #14848
Conversation
Download the artifacts for this pull request: |
Interesting. Not much changes overall. I think it is pretty tamed by default. Probably to make it useful, some more checks could be enabled. Not saying to be pedantic, but some minor things like mixed single and double string quotes, line length, some more common checks in python world, would probably be useful. We don't have much python code, so not really makes much difference either way, but might as well improve what we have. |
c4d5fb0
to
2f0848c
Compare
@kasper93 I've add a number of common checks that seem helpful:
|
Looks quite complete now, thanks. There are remaining issues with scripts though, look up the CI result for them. |
Could this be adjusted to only run when a file with *.py is modified? Feels wasteful to run this everytime a PR is submitted |
2f0848c
to
fd5308f
Compare
@llyyr I looked into this briefly, but it seems like you can only exclude workflow execution based on files changed, not the jobs within. I'm happy to split it out into it's own workflow, but I wasn't sure if that is what you intended. I should also mention that the workflow took 7 seconds last time, so it may not have a huge impact. |
not sure about your last commit ci/lint: fix macos dylib_unhell.py build issue should be part of [edit] |
I agree on this point, we should use 100 limit in linters, while trying to keep it in 80 range, no point in forcing it if it looks worse. |
Enabled the ruff python linter in CI, and resolved the issues that were detected by it. Ruff was used due to it's faster checking compared with other linters like pylint. This was added to resolve the python linting request in mpv-player#13608.
This change required some minor rework to make the code conform to the following: - Restrict line length to 88 character - Use spaces rather than tabs (only affect ci/lint-commit-msg.py) - Use f-strings rather than % formatting or `str.format()`
7eeb79f
to
9837bcc
Compare
I've updated the linter to only check for 100 characters per line. |
thanks for the changes and fixes. i quickly tested the macOS specific changes and the script still produce what is expected. |
I see no point to keep it in limbo, let's iterate on master if needed. |
Enabled the ruff python linter in CI, and resolved the issues that were detected by it. Ruff was used due to it's faster checking compared with other linters like pylint. This was added to resolve the python linting request in #13608.