mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-24 13:33:50 +00:00
Add some minor tweaks to latest docs (#5164)
This commit is contained in:
parent
98920909c6
commit
f18e10183f
2 changed files with 9 additions and 8 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue