-
-
Notifications
You must be signed in to change notification settings - Fork 62
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
Enable more ruff rules #269
Merged
Merged
Conversation
This file contains 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
See: https://docs.astral.sh/ruff/rules/#pyupgrade-up Fix the following new warnings: lieer/gmailieer.py:622:23: UP030 Use implicit references for positional format fields lieer/gmailieer.py:622:23: UP032 [*] Use f-string instead of `format` call lieer/local.py:126:26: UP015 [*] Unnecessary open mode parameters lieer/local.py:129:27: UP032 [*] Use f-string instead of `format` call lieer/local.py:270:26: UP015 [*] Unnecessary open mode parameters lieer/local.py:273:27: UP032 [*] Use f-string instead of `format` call lieer/local.py:278:26: UP015 [*] Unnecessary open mode parameters lieer/local.py:281:27: UP032 [*] Use f-string instead of `format` call lieer/local.py:567:28: UP031 Use format specifiers instead of percent format lieer/local.py:685:17: UP031 Use format specifiers instead of percent format lieer/local.py:723:21: UP031 Use format specifiers instead of percent format lieer/remote.py:660:25: UP031 Use format specifiers instead of percent format lieer/remote.py:666:25: UP031 Use format specifiers instead of percent format lieer/remote.py:673:25: UP031 Use format specifiers instead of percent format lieer/remote.py:679:17: UP031 Use format specifiers instead of percent format
See: https://docs.astral.sh/ruff/rules/#flake8-simplify-sim Fix the following new warnings: lieer/gmailieer.py:941:13: SIM108 Use ternary operator `total = len(msgids) + len(previous.meta_fetched) if resume else len(msgids)` instead of `if`-`else`-block lieer/gmailieer.py:1053:14: SIM201 [*] Use `header_recipients != cli_recipients` instead of `not header_recipients == cli_recipients` lieer/local.py:283:24: SIM118 Use `key in dict` instead of `key in dict.keys()` lieer/local.py:371:25: SIM115 Use context handler for opening files lieer/remote.py:648:13: SIM102 Use a single `if` statement instead of nested `if` statements
See: https://docs.astral.sh/ruff/rules/#isort-i Fix the following new warnings: lieer/gmailieer.py:21:1: I001 [*] Import block is un-sorted or un-formatted lieer/local.py:18:1: I001 [*] Import block is un-sorted or un-formatted lieer/remote.py:18:1: I001 [*] Import block is un-sorted or un-formatted lieer/resume.py:18:1: I001 [*] Import block is un-sorted or un-formatted setup.py:9:1: I001 [*] Import block is un-sorted or un-formatted tests/test_local.py:1:1: I001 [*] Import block is un-sorted or un-formatted
See: https://docs.astral.sh/ruff/rules/#flake8-comprehensions-c4 Fix the following new warnings: lieer/local.py:55:21: C405 Unnecessary `list` literal (rewrite as a `set` literal) lieer/local.py:205:36: C403 Unnecessary `list` comprehension (rewrite as a `set` comprehension) lieer/local.py:213:45: C403 Unnecessary `list` comprehension (rewrite as a `set` comprehension) lieer/local.py:351:13: C419 Unnecessary list comprehension. lieer/remote.py:77:24: C405 Unnecessary `list` literal (rewrite as a `set` literal) lieer/remote.py:78:22: C405 Unnecessary `list` literal (rewrite as a `set` literal) lieer/remote.py:93:16: C405 Unnecessary `list` literal (rewrite as a `set` literal)
See: https://docs.astral.sh/ruff/rules/#perflint-perf Fix the following new warnings: lieer/gmailieer.py:866:17: PERF401 Use a list comprehension to create a transformed list
gauteh
reviewed
Dec 3, 2023
Merged, thanks. |
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.
This PR enables a bunch more ruff rules. They have quite a long list of various rules, so I picked some of the more low-hanging fruit here.
Some of the fixes are arguably mostly stylistic (e.g.
isort
might help when merging, but doesn't do much else), but some of them might improve performance (Perflint
,flake8-comprehensions
), even if only slightly.