-
-
Notifications
You must be signed in to change notification settings - Fork 748
Enforce ruff rules (RUF) #9153
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
Enforce ruff rules (RUF) #9153
Conversation
86fd6d2 to
9129511
Compare
Unit Test ResultsSee test report for an extended history of previous test failures. This is useful for diagnosing flaky tests. 27 files ±0 27 suites ±0 9h 50m 53s ⏱️ - 4m 24s For more details on these failures, see this check. Results for commit 426420e. ± Comparison against base commit d55a2fd. ♻️ This comment has been updated with latest results. |
jacobtomlinson
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are some good readability and performance improvements in here thanks! Are you not enforcing because they require manually fixing? If they need manual work then I think we should not enforce them.
Personally I would only use next(iter(...)) in cases where performance matters as it's not so novice friendly. If we really want to get away from x = list(...)[0] we can always use [x, _*] = ... which can be easier for novices to parse than x = next(iter(...)).
I also think RUF010 reduces readability by using advanced f-string expressions. The original code was already very readable.
9129511 to
7faba41
Compare
|
I'm not enforcing the I agree that Finally, I modified manually the result of |
Yes sounds good
Fair point. I think |
|
Rebased + ignoring |
51e292a to
5aef20a
Compare
RUF003 Comment contains ambiguous ` ` (NO-BREAK SPACE). Did you mean ` ` (SPACE)?
RUF007 Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs
RUF010 Use explicit conversion flag
RUF017 Avoid quadratic list summation
RUF046 Value being cast to `int` is already an integer
RUF051 Use `pop` instead of `key in dict` followed by `del dict[key]`
83e0a79 to
3a29f59
Compare
3a29f59 to
426420e
Compare
I am not enforcing these rules yet.I've left out a bunch of rules.