astral-sh / astral-sh/ruff

New rule request: Remove redundant parentheses

Open
#6,906 1 comment 20 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs-decision rule
Dominant language
Rust
Stars
49.7k
Forks
2.4k
Avg merge
2d 1h
Merged PRs (30d)
458

Description

It would be really cool if Ruff could catch this:
```python
def func(x: bool) -> int:
if (x):
return 1
return 0
```
(PyCharm will complain about this: "Remove redundant parentheses")

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Use the Python example in the issue as the reproduction case, then locate Ruff's existing rule implementations and tests for similar simplification diagnostics. Add coverage for redundant parentheses around the if-condition and verify that the example is reported while valid parentheses cases remain unaffected.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, rust
Domain
tooling
Issue type
Feature
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.