ruff/crates/ruff_linter/resources/test/fixtures/flake8_comprehensions
Harutaka Kawamura 6195c026ff
[flake8-comprehensions] Skip C416 if comprehension contains unpacking (#14909)
<!--
Thank you for contributing to Ruff! To help us out with reviewing,
please consider the following:

- Does this pull request include a summary of the change? (See below.)
- Does this pull request include a descriptive title?
- Does this pull request include references to any relevant issues?
-->

## Summary

<!-- What's the purpose of the change? What does it do, and why? -->

Fix #11482. Applies
https://github.com/adamchainz/flake8-comprehensions/pull/205 to ruff.
`C416` should be skipped if comprehension contains unpacking. Here's an
example:

```python
list_of_lists = [[1, 2], [3, 4]]

# ruff suggests `list(list_of_lists)` here, but that would change the result.
# `list(list_of_lists)` is not `[(1, 2), (3, 4)]`
a = [(x, y) for x, y in list_of_lists]

# This is equivalent to `list(list_of_lists)`
b = [x for x in list_of_lists]
```

## Test Plan

<!-- How was it tested? -->

Existing checks

---------

Signed-off-by: harupy <hkawamura0130@gmail.com>
2024-12-20 14:35:30 +05:30
..
C400.py [flake8-comprehension] Strip parentheses around generators in C400 (#11607) 2024-05-30 03:26:56 +00:00
C401.py [flake8-comprehensions] Handled special case for C401 which also matches C416 (#10596) 2024-03-26 03:54:58 +00:00
C402.py
C403.py
C404.py
C405.py
C406.py
C408.py Remove CST-based fixer for C408 (#9822) 2024-02-04 22:26:51 -05:00
C409.py [flake8-comprehensions] Account for list and set comprehensions in unnecessary-literal-within-tuple-call (C409) (#12657) 2024-08-04 22:14:52 -04:00
C410.py Remove CST-based fixers for C400, C401, C410, and C418 (#9819) 2024-02-04 21:00:11 -05:00
C411.py
C413.py Wrap expressions in parentheses when negating (#10346) 2024-03-11 18:20:55 -04:00
C414.py
C415.py
C416.py [flake8-comprehensions] Skip C416 if comprehension contains unpacking (#14909) 2024-12-20 14:35:30 +05:30
C417.py [flake8-comprehensions] Skip iterables with named expressions in unnecessary-map (C417) (#14827) 2024-12-06 22:00:33 -05:00
C418.py
C419.py [flake8-comprehensions] Do not lint async for comprehensions in unnecessary-comprehension-in-call (C419) (#12895) 2024-08-15 01:00:10 +00:00
C419_1.py Raise syntax error for unparenthesized generator expr in multi-argument call (#12445) 2024-07-22 14:44:20 +05:30
C419_2.py [flake8_comprehensions] add sum/min/max to unnecessary comprehension check (C419) (#10759) 2024-04-03 14:44:33 -06:00
C420.py Re-code unnecessary-dict-comprehension-for-iterable (RUF025) as C420 (#12533) 2024-08-14 18:15:45 +02:00