New rule request: Remove redundant parentheses
Open
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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