From 253474b3123445e96c677c64e1e343b0d8c28e48 Mon Sep 17 00:00:00 2001 From: Ryan Hoban Date: Fri, 9 Aug 2024 11:28:50 -0400 Subject: [PATCH] Document that BLE001 supports both BaseException and Exception (#12788) --- .../src/rules/flake8_blind_except/rules/blind_except.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/ruff_linter/src/rules/flake8_blind_except/rules/blind_except.rs b/crates/ruff_linter/src/rules/flake8_blind_except/rules/blind_except.rs index 35945d9c1d..8682a1268c 100644 --- a/crates/ruff_linter/src/rules/flake8_blind_except/rules/blind_except.rs +++ b/crates/ruff_linter/src/rules/flake8_blind_except/rules/blind_except.rs @@ -10,7 +10,9 @@ use ruff_text_size::Ranged; use crate::checkers::ast::Checker; /// ## What it does -/// Checks for `except` clauses that catch all exceptions. +/// Checks for `except` clauses that catch all exceptions. This includes +/// bare `except`, `except BaseException` and `except Exception`. +/// /// /// ## Why is this bad? /// Overly broad `except` clauses can lead to unexpected behavior, such as @@ -58,6 +60,7 @@ use crate::checkers::ast::Checker; /// ## References /// - [Python documentation: The `try` statement](https://docs.python.org/3/reference/compound_stmts.html#the-try-statement) /// - [Python documentation: Exception hierarchy](https://docs.python.org/3/library/exceptions.html#exception-hierarchy) +/// - [PEP8 Programming Recommendations on bare `except`](https://peps.python.org/pep-0008/#programming-recommendations) #[violation] pub struct BlindExcept { name: String,