From f18e10183f439e076daef36b93e564bb62f29a35 Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Sat, 17 Jun 2023 13:04:50 -0400 Subject: [PATCH] Add some minor tweaks to latest docs (#5164) --- .../rules/flake8_blind_except/rules/blind_except.rs | 11 ++++++----- .../rules/unnecessary_paren_on_raise_exception.rs | 6 +++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/crates/ruff/src/rules/flake8_blind_except/rules/blind_except.rs b/crates/ruff/src/rules/flake8_blind_except/rules/blind_except.rs index 428809b394..b5f0eae9e9 100644 --- a/crates/ruff/src/rules/flake8_blind_except/rules/blind_except.rs +++ b/crates/ruff/src/rules/flake8_blind_except/rules/blind_except.rs @@ -8,14 +8,15 @@ use ruff_python_semantic::analyze::logging; use crate::checkers::ast::Checker; /// ## What it does -/// Checks for blind `except` clauses. +/// Checks for `except` clauses that catch all exceptions. /// /// ## Why is this bad? -/// Blind exception handling can hide bugs and make debugging difficult. It can -/// also lead to unexpected behavior, such as catching `KeyboardInterrupt` or -/// `SystemExit` exceptions that prevent the user from exiting the program. +/// Overly broad `except` clauses can lead to unexpected behavior, such as +/// catching `KeyboardInterrupt` or `SystemExit` exceptions that prevent the +/// user from exiting the program. /// -/// Instead of catching all exceptions, catch only the exceptions you expect. +/// Instead of catching all exceptions, catch only those that are expected to +/// be raised in the `try` block. /// /// ## Example /// ```python diff --git a/crates/ruff/src/rules/flake8_raise/rules/unnecessary_paren_on_raise_exception.rs b/crates/ruff/src/rules/flake8_raise/rules/unnecessary_paren_on_raise_exception.rs index b73cd55e01..ee3b0d7e69 100644 --- a/crates/ruff/src/rules/flake8_raise/rules/unnecessary_paren_on_raise_exception.rs +++ b/crates/ruff/src/rules/flake8_raise/rules/unnecessary_paren_on_raise_exception.rs @@ -11,11 +11,11 @@ use crate::registry::AsRule; /// Checks for unnecessary parentheses on raised exceptions. /// /// ## Why is this bad? -/// If no arguments are passed to an exception, parentheses are not required. -/// This is because the `raise` statement accepts either an exception instance +/// If an exception is raised without any arguments, parentheses are not +/// required, as the `raise` statement accepts either an exception instance /// or an exception class (which is then implicitly instantiated). /// -/// Removing unnecessary parentheses makes code more readable and idiomatic. +/// Removing the parentheses makes the code more concise. /// /// ## Example /// ```python