-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Support for refurb #1348
Comments
builtin
contextlib
datetimedecimal
flow
function
functools
iterableitertoolslogical
math
pathlib
readability
string
FastAPI
Misc
Pattern matching
Regex
|
@charliermarsh Are there any examples of rules where |
Hi, creator of Refurb here! I've added a bunch of checks since this issue was opened, so I would like to give an updated list of what's new. I also went ahead and checked all the existing items on the list to see which ones have been completed and need to be marked off. The docs explaining each of the checks can be found here. These Refurb checks are already in Ruff and can be checked off:
In the process I found a bunch of rules in Ruff that are either giving false positives or aren't emitting errors for all the tests in the Refurb test suite. I wouldn't consider these 100% merged, but I'll list them here anyways and will open issues individually later:
The rest are new checks that have been added since this issue was opened, and don't tie to any existing rule in Ruff. I tried to maintain the same format as the comment by @sbrugman builtin
Datetime
Decimal
FastAPI
Math
Misc
Pathlib
Pattern matching
Readability
Regex
String
That's it! Feel free to hide/edit this comment once the original comment gets updated. |
@dosisod Thanks for the extensive review, I've updated the tracking. The rules that are nearly implemented because of the different behaviours on some tests cases we will mark as complete as they are fixed. Currently working on |
Hey there folks, I'm working on FURB113. |
Also implemented FURB131 and FURB132. @charliermarsh WDYT? Do you think it's worth it? Thanks! |
## Summary As an initial effort with replicating `refurb` rules (#1348 ), this PR adds support for [FURB113](https://github.com/dosisod/refurb/blob/master/refurb/checks/builtin/list_extend.py) and adds a new category of checks. ## Test Plan I included a new test + checked that all other tests pass.
## Summary This PR is a continuation of #6702 and me replicating `refurb` rules (#1348). It adds support for [FURB131](https://github.com/dosisod/refurb/blob/master/refurb/checks/builtin/no_del.py. ## Test Plan I included a new test + checked that all other tests pass.
## Summary This PR is a continuation of #6897 and #6702 and me replicating `refurb` rules (#1348). It adds support for [FURB132](https://github.com/dosisod/refurb/blob/master/refurb/checks/builtin/set_discard.py) ## Test Plan I included a new test + checked that all other tests pass.
Released a (small) update with a few notable changes: New checks:
Both of the above checks improved performance when using the suggested changes, at least in the micro benchmarks I ran. Improved checks:
Also, there are a lot of scattered check-lists throughout this issue, perhaps we could consolidate them into the comment at the top? At the very least I could consolidate my comments into one, if that helps. |
Isn't FURB142 already implemented as PLC0208? |
## Summary Implement FURB157 in the issue #1348. Relevant Refurb docs is here: https://github.com/dosisod/refurb/blob/master/docs/checks.md#furb157-simplify-decimal-ctor ## Test Plan I've written it in the `FURB157.py`.
Working on |
## Summary <!-- What's the purpose of the change? What does it do, and why? --> Implement FURB164 in the issue #1348. Relevant Refurb docs is here: https://github.com/dosisod/refurb/blob/v2.0.0/docs/checks.md#furb164-no-from-float I've changed the name from `no-from-float` to `verbose-decimal-fraction-construction`. ## Test Plan <!-- How was it tested? --> I've written it in the `FURB164.py`. --------- Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
## Summary implement int_on_sliced_str (FURB166) lint - #1348 - [original lint](https://github.com/dosisod/refurb/blob/master/refurb/checks/builtin/use_int_base_zero.py) ## Test Plan cargo test
…0687) ## Summary Add [`FURB110`](https://github.com/dosisod/refurb/blob/master/refurb/checks/logical/use_or.py) See: #1348 ## Test Plan `cargo test`
…`) (#10526) ## Summary Lint about function like expressions which are equivalent to `operator.itemgetter`. See: #1348 (comment) ## Test Plan cargo test
…tral-sh#10687) ## Summary Add [`FURB110`](https://github.com/dosisod/refurb/blob/master/refurb/checks/logical/use_or.py) See: astral-sh#1348 ## Test Plan `cargo test`
…`) (astral-sh#10526) ## Summary Lint about function like expressions which are equivalent to `operator.itemgetter`. See: astral-sh#1348 (comment) ## Test Plan cargo test
## Summary Implement `write-whole-file` (`FURB103`), part of astral-sh#1348. This is largely a copy and paste of `read-whole-file` astral-sh#7682. ## Test Plan Text fixture added. --------- Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
Implement repeated_global (FURB154) lint. See: - #1348 - [original lint](https://github.com/dosisod/refurb/blob/master/refurb/checks/builtin/simplify_global_and_nonlocal.py) ## Test Plan cargo test
## Summary Implementation for one of the rules in #1348 Refurb only deals only with classes with a single base, however the rule is valid for any base. (`str, Enum` is common prior to `StrEnum`) ## Test Plan `cargo test` --------- Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
It would be nice to have support for refurb (https://github.com/dosisod/refurb) - a great tool for simplifying and modernizing Python code. It currently includes 48 checks.
The text was updated successfully, but these errors were encountered: