style: enable lots more Ruff lints, apply lint suggestions#1127
Merged
RoyalOughtness merged 5 commits intosecureblue:livefrom Jun 25, 2025
Merged
style: enable lots more Ruff lints, apply lint suggestions#1127RoyalOughtness merged 5 commits intosecureblue:livefrom
RoyalOughtness merged 5 commits intosecureblue:livefrom
Conversation
Collaborator
Author
|
I think it might make sense to disable Lizard in Codacy, as the mccabe cyclomatic complexity lint enabled by this PR seems to be computing complexity of Python code in a more sensible way. For example, Lizard is currently flagging perms.session_bus_talk = [key for key, value in lines.items() if value == "talk"]with the equivalent but much less readable perms.session_bus_talk = list(map(lambda x: x[0], filter(lambda x: x[1] == "talk", lines.items())))and likewise for the other similar list comprehensions in that function, its cyclomatic complexity as measured by Lizard would drop to 3. |
Collaborator
|
@HastD makes sense, as long as we're checking for it somewhere, that's fine by me |
RoyalOughtness
previously approved these changes
Jun 22, 2025
The enabled lints include many of the lints from Flake8, Pylint, Bandit, and Pyupgrade. Also factored out part of the parsing logic of the function `parse_flatpak_permissions` to reduce cyclomatic complexity. Signed-off-by: Daniel Hast <[email protected]>
This simplifies its usage and reduces complexity of several functions.
...and simplify audit_hardened_malloc so it passes the check.
"has" for single flatpaks, "have" when referring to multiple flatpaks
RoyalOughtness
approved these changes
Jun 23, 2025
WavyEbuilder
approved these changes
Jun 25, 2025
WavyEbuilder
approved these changes
Jun 25, 2025
RoyalOughtness
pushed a commit
to RoyalOughtness/secureblue-dev
that referenced
this pull request
Aug 4, 2025
…e#1127) * style: enable lots more Ruff lints, apply lint suggestions The enabled lints include many of the lints from Flake8, Pylint, Bandit, and Pyupgrade. Also factored out part of the parsing logic of the function `parse_flatpak_permissions` to reduce cyclomatic complexity. Signed-off-by: Daniel Hast <[email protected]> * refactor: make parse_config return dict instead of generator This simplifies its usage and reduces complexity of several functions. * style: enable cyclomatic complexity checking in Ruff ...and simplify audit_hardened_malloc so it passes the check. * fix: grammar issue in flatpak permissions checks "has" for single flatpaks, "have" when referring to multiple flatpaks --------- Signed-off-by: Daniel Hast <[email protected]>
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.
The enabled lints include many of the lints from Flake8, Pylint, Bandit, Pyupgrade, and mccabe (a cyclomatic complexity checker). Also simplified
parse_configand factored out part of the parsing logic of the functionparse_flatpak_permissionsto reduce cyclomatic complexity of several functions, and fixed a small grammar issue withPermissionCheck.