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

[flake8-bugbear] Improve assert-raises-exception (B017) message #15389

Merged
merged 1 commit into from
Jan 10, 2025

Conversation

tjkuson
Copy link
Contributor

@tjkuson tjkuson commented Jan 10, 2025

Summary

Changes the assert-raises-exception (B017) message to be more helpful. In doing so, the message is shorter and the implementation simpler as the diagnostic no longer needs to print the assertion.

- B017.py:45:10: B017 `pytest.raises(Exception)` should be considered evil
+ B017.py:45:10: B017 Do not assert blind exception: `Exception`

This assertion message is a corollary of blind-except (BLE001).

Do not catch blind exception: {name}

Test Plan

cargo nextest run

Copy link
Contributor

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@MichaReiser MichaReiser added the rule Implementing or modifying a lint rule label Jan 10, 2025
@MichaReiser
Copy link
Member

Thanks

@MichaReiser MichaReiser merged commit 23ad319 into astral-sh:main Jan 10, 2025
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rule Implementing or modifying a lint rule
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants