-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Labels
bugSomething isn't workingSomething isn't workingfixesRelated to suggested fixes for violationsRelated to suggested fixes for violations
Description
FURB187 autofix causes breaking changes when applied to function arguments
I have the FURB ruleset set to autofix but found the autofix for FURB187 was breaking code when applied to arguments of functions since it was mutating objects outside of the function scope.
Example Code
def local_reverse_print_list(some_list: list[int]):
some_list = list(reversed(some_list)) # FURB187 will fix to: some_list.reverse()
print(f"Function shows list as: {some_list}")
a_list = [1,2,3]
local_reverse_print_list(a_list)
print(f"Original list: {a_list}") # Oops - the outside list is now mutated too after the FURB187 fixRuff settings (relevant subset of actual settings)
[tool.ruff.lint]
# See https://docs.astral.sh/ruff/rules/
select = [
"FURB",
]
# Allow fix for all enabled rules (when `--fix`) is provided.
fixable = ["ALL"]
unfixable = []Ruff version
0.5.1
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingfixesRelated to suggested fixes for violationsRelated to suggested fixes for violations