Skip to content

Complain about redundant ternaries? #12516

@janosh

Description

@janosh

while refactoring i got this code and was fully expecting ruff to complain about the redundant ternary but it doesn't. maybe worth adding a rule for this?

def test_the_answer():
    expected = 42 if below_311 else 42
    assert the_answer == expected

Metadata

Metadata

Assignees

Labels

good first issueGood for newcomershelp wantedContributions especially welcomeruleImplementing or modifying a lint rule

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions