Dan Parizher
3e366fdf13
[`refurb`] Ignore decorated functions for `FURB118` ( #19339 )
...
## Summary
Fixes #19305
2025-07-25 10:43:17 -05:00
Alex Waygood
d8bca0d3a2
Fix bug where methods defined using lambdas were flagged by FURB118 ( #14639 )
2024-11-28 12:58:23 +00:00
Zanie Blue
58a8e9c511
Fix handling of slices in tuples for FURB118, e.g., `x[:, 1]` ( #13518 )
...
There was already handling for the singleton `x[:]` case but not the
tuple case.
Closes https://github.com/astral-sh/ruff/issues/13508
2024-09-26 14:20:03 +00:00
Embers-of-the-Fire
ea27445479
[`refurb`] Fix misbehavior of `operator.itemgetter` when getter param is a tuple ( #11774 )
2024-06-07 03:10:52 +00:00
Charlie Marsh
ab107ef1f3
Avoid recomending operator.itemgetter with dependence on lambda arg ( #11574 )
...
## Summary
Closes https://github.com/astral-sh/ruff/issues/11573 .
2024-05-28 01:29:29 +00:00
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