Repository navigation
Fix all pyflakes errors and require zero pyflakes errors in CI - #2915
Merged
Merged
Conversation
The `--diff` option was removed in flake8 6.0.0, and differential checking is unreliable for pyflakes errors anyway. Fix all existing pyflakes errors and check the whole code base for them, while continuing to check only modified lines with pycodestyle. Bugs fixed along the way: - CredentialApplication.accept() referenced an undefined `request` when handling DatabaseError; let the error propagate instead. - loaddemo used `sys.exit` without importing sys. - The model project help texts defined `usage_notes` twice, so the software text overrode the model-specific one. - Two notification functions shadowed the `user` module with a loop variable. Also remove unused imports and variables, stop re-exporting GCP helpers from console.utility, and drop the F401/F403 global ignores in favour of per-file ignores for settings and aggregate model modules. The style workflow now installs pinned linters from a new `lint` dependency group via uv. Fixes #2317
Chrystinne
approved these changes
Nov 22, 2026
Chrystinne
left a comment
Contributor
There was a problem hiding this comment.
Looks good to me, @tompollard. I checked the pyflakes run with the pinned versions (clean across the tree), the four bug fixes, and that nothing still references the removed console.utility GCP re-exports (including mocks in tests).
Minor (optional): the docstrings of CredentialApplication.accept() and withdraw() say "Reject a credentialing application."; since accept() is touched here, it could be fixed in passing.
Member
Author
|
Thanks @Chrystinne!
Good catch, I'll fix later just to avoid this needing re-approval. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2317.
flake8 removed its
--diffoption in 6.0.0, and differential checking doesn't work reliably for pyflakes errors anyway. Following the plan in the issue discussion, this PR:pycodestyle --diffis still supported).Bugs found by pyflakes
CredentialApplication.accept()caughtDatabaseErrorand then calledmessages.error(request, ...)with an undefinedrequest, which would have raised aNameError. The error now propagates to the caller.loaddemocalledsys.exit()without importingsys.usage_notestwice, so the software text ("How the software is to be used...") overrode the model-specific one ("Describe how you intend others to (re)use the model."). The duplicate is removed, so model projects now show the intended text.useras a loop variable, shadowing the importedusermodule.Cleanup
console.viewsandproject.utilitynow import the GCP helpers fromproject.cloud.gcpdirectly instead of via re-exports inconsole.utility.project.modelcomponents.legacynow importsProjectTypefrom its own module..flake8no longer ignores F401/F403 globally. They are ignored only for the settings modules (star imports) and the aggregateproject/models.pyandsearch/models.py.demo-filesand.venvare excluded.Workflow
lintdependency group (flake8, flake8-noqa, pycodestyle, pyflakes) inpyproject.toml/uv.lock, so linter versions are pinned and match local runs.style.ymlinstalls it with uv and runs:flake8 --select F,NQAon the whole tree, which must be clean,git diff -U0 HEAD^ HEAD | pycodestyle --diff ...on modified lines, with the same options as before (max-line-length = 119, ignoreW503).To run the checks locally:
@tompollard 🟩 green 🐙 octopus · thunder