Charlie Marsh
894cd13ec1
[`refurb`] Ignore methods in `reimplemented-operator` (`FURB118`) ( #11270 )
...
## Summary
This rule does more harm than good when applied to methods.
Closes https://github.com/astral-sh/ruff/issues/10898 .
Closes https://github.com/astral-sh/ruff/issues/11045 .
2024-05-03 20:03:12 +00:00
Charlie Marsh
925c7f8dd3
[`refurb`] Advoid `operator.itemgetter` suggestion for single-item tuple ( #11095 )
...
## Summary
The `operator.itemgetter` behavior changes where there's more than one
argument, such that `operator.itemgetter(0)` yields `r[0]`, rather than
`(r[0],)`.
Closes https://github.com/astral-sh/ruff/issues/11075 .
2024-04-23 00:20:43 +00:00
Aleksei Latyshev
6050bab5db
[`refurb`] Support `itemgetter` in `reimplemented-operator` (`FURB118`) ( #10526 )
...
## Summary
Lint about function like expressions which are equivalent to
`operator.itemgetter`.
See:
https://github.com/astral-sh/ruff/issues/1348#issuecomment-1909421747
## Test Plan
cargo test
2024-04-07 02:31:59 +00:00
Charlie Marsh
be8f8e62b5
Reverse order of arguments for `operator.contains` ( #9192 )
...
Closes https://github.com/astral-sh/ruff/issues/9191 .
2023-12-18 14:39:52 -05:00
Tuomas Siipola
c532089fb3
Implement `reimplemented_operator` (FURB118) ( #9171 )
...
## Summary
Implement
[FURB118](https://github.com/dosisod/refurb/blob/master/docs/checks.md#furb118-use-operator )
that recommends, for example, that `lambda x, y: x + y` is replaced with
`operator.add`. Part of #1348 .
## Test Plan
Added test cases.
2023-12-18 14:59:16 +00:00