Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Complain about redundant ternaries? #12516

Closed
janosh opened this issue Jul 25, 2024 · 5 comments
Closed

Complain about redundant ternaries? #12516

janosh opened this issue Jul 25, 2024 · 5 comments
Assignees
Labels
good first issue Good for newcomers help wanted Contributions especially welcome rule Implementing or modifying a lint rule

Comments

@janosh
Copy link

janosh commented Jul 25, 2024

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
@charliermarsh charliermarsh added the rule Implementing or modifying a lint rule label Jul 25, 2024
@charliermarsh
Copy link
Member

That seems reasonable to me.

@charliermarsh charliermarsh added good first issue Good for newcomers help wanted Contributions especially welcome labels Jul 27, 2024
@njhearp
Copy link
Contributor

njhearp commented Aug 15, 2024

I'm interested in working on this, but I'll be away for a week. If this issue is still open when I return, I would be happy to work on it.

@iamlucasvieira
Copy link
Contributor

Hey @njhearp, have you started working on this? If not, I’d love to take it. Let me know!

@njhearp
Copy link
Contributor

njhearp commented Sep 1, 2024

Hey @iamlucasvieira, you can take the issue. I tried working on the issue, but had difficulties because it is my first time trying to contribute.

@MichaReiser
Copy link
Member

Implemented in #13218

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Contributions especially welcome rule Implementing or modifying a lint rule
Projects
None yet
Development

No branches or pull requests

5 participants