mirror of https://github.com/astral-sh/ruff
Add some minor tweaks to latest docs (#5164)
This commit is contained in:
parent
98920909c6
commit
f18e10183f
|
|
@ -8,14 +8,15 @@ use ruff_python_semantic::analyze::logging;
|
||||||
use crate::checkers::ast::Checker;
|
use crate::checkers::ast::Checker;
|
||||||
|
|
||||||
/// ## What it does
|
/// ## What it does
|
||||||
/// Checks for blind `except` clauses.
|
/// Checks for `except` clauses that catch all exceptions.
|
||||||
///
|
///
|
||||||
/// ## Why is this bad?
|
/// ## Why is this bad?
|
||||||
/// Blind exception handling can hide bugs and make debugging difficult. It can
|
/// Overly broad `except` clauses can lead to unexpected behavior, such as
|
||||||
/// also lead to unexpected behavior, such as catching `KeyboardInterrupt` or
|
/// catching `KeyboardInterrupt` or `SystemExit` exceptions that prevent the
|
||||||
/// `SystemExit` exceptions that prevent the user from exiting the program.
|
/// 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
|
/// ## Example
|
||||||
/// ```python
|
/// ```python
|
||||||
|
|
|
||||||
|
|
@ -11,11 +11,11 @@ use crate::registry::AsRule;
|
||||||
/// Checks for unnecessary parentheses on raised exceptions.
|
/// Checks for unnecessary parentheses on raised exceptions.
|
||||||
///
|
///
|
||||||
/// ## Why is this bad?
|
/// ## Why is this bad?
|
||||||
/// If no arguments are passed to an exception, parentheses are not required.
|
/// If an exception is raised without any arguments, parentheses are not
|
||||||
/// This is because the `raise` statement accepts either an exception instance
|
/// required, as the `raise` statement accepts either an exception instance
|
||||||
/// or an exception class (which is then implicitly instantiated).
|
/// 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
|
/// ## Example
|
||||||
/// ```python
|
/// ```python
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue