ruff
491a5196 - [`ruff`] Support slices in `RUF005` (#17078)

Commit
171 days ago
[`ruff`] Support slices in `RUF005` (#17078) ## Summary Teaches `RUF005` to also consider slices for concatenation. Other indexing (`foo[0] + [7, 8, 9] + bar[1]`) is explicitly not considered. ```diff foo = [4, 5, 6] -bar = [1, 2, 3] + foo -slicing1 = foo[:1] + [7, 8, 9] -slicing2 = [7, 8, 9] + bar[1:] -slicing3 = foo[:1] + [7, 8, 9] + bar[1:] +bar = [1, 2, 3, *foo] +slicing1 = [*foo[:1], 7, 8, 9] +slicing2 = [7, 8, 9, *bar[1:]] +slicing3 = [*foo[:1], 7, 8, 9, *bar[1:]] ``` ## Test Plan Manually tested (diff above from `ruff check --diff`), snapshot updated.
Author
akx akx
Parents
Loading