astral-sh / astral-sh/ruff

Pylint rule expression-not-assigned no triggered on list comprehension W0106 (B018)

Open
#20,132 2 comments 1 reaction 0 assignees View on GitHub
needs-decision rule
Dominant language
Rust
Stars
49.6k
Forks
2.4k
Avg merge
2d 1h
Merged PRs (30d)
458

Description

### Summary

Pylint W0106 is triggered on each line of this code:

```py
[x + 1 for x in range(10)]
[1 for _ in range(2)]
[x in range(5) if x > 3 else 0 for x in range(10)]
```

But ruffs corresponding rule `B018` is not triggered on either.

### Version

ruff 0.11.13

Contributor guide

Open the contributing guide

Research direction

Reproduce the three list-comprehension examples with Ruff 0.11.13 and compare their behavior with Pylint W0106. Trace the implementation and tests for the corresponding B018 rule; done means each unused list comprehension is reported consistently with the intended rule behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, rust
Domain
devtools, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.