astral-sh / astral-sh/ruff

BLE001: detect contextlib.suppress ?

Open
#19,306 1 comment 0 reactions 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

```python
try:
foo()
except BaseException:
pass
```
is detected as `BLE001`, while the following isn't:

```python
with contextlib.suppress(BaseException):
foo()
```

please consider if that would make sense to detect it.

Contributor guide

Open the contributing guide

Research direction

Start from Ruff's BLE001 rule and compare how the two Python examples are analyzed. Determine whether contextlib.suppress(BaseException) should be reported consistently with the try/except example, then add or update coverage so the intended behavior is explicit.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, rust
Domain
devtools
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.