Add some minor tweaks to latest docs (#5164)

This commit is contained in:
Charlie Marsh 2023-06-17 13:04:50 -04:00 committed by GitHub
parent 98920909c6
commit f18e10183f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 8 deletions

View file

@ -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

View file

@ -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