mirror of
https://github.com/astral-sh/ruff.git
synced 2026-05-06 08:56:57 -04:00
Stabilize RUF061 (#22917)
I made two small tweaks to the docs, but this otherwise looked good to me. https://docs.astral.sh/ruff/rules/legacy-form-pytest-raises/
This commit is contained in:
@@ -11,10 +11,11 @@ use std::fmt;
|
||||
use crate::{FixAvailability, Violation, checkers::ast::Checker};
|
||||
|
||||
/// ## What it does
|
||||
/// Checks for non-contextmanager use of `pytest.raises`, `pytest.warns`, and `pytest.deprecated_call`.
|
||||
/// Checks for non-context-manager use of `pytest.raises`, `pytest.warns`, and `pytest.deprecated_call`.
|
||||
///
|
||||
/// ## Why is this bad?
|
||||
/// The context-manager form is more readable, easier to extend, and supports additional kwargs.
|
||||
/// The context-manager form is more readable, easier to extend, and supports additional keyword
|
||||
/// arguments.
|
||||
///
|
||||
/// ## Example
|
||||
/// ```python
|
||||
@@ -44,7 +45,7 @@ use crate::{FixAvailability, Violation, checkers::ast::Checker};
|
||||
/// - [`pytest` documentation: `pytest.warns`](https://docs.pytest.org/en/latest/reference/reference.html#pytest-warns)
|
||||
/// - [`pytest` documentation: `pytest.deprecated_call`](https://docs.pytest.org/en/latest/reference/reference.html#pytest-deprecated-call)
|
||||
#[derive(ViolationMetadata)]
|
||||
#[violation_metadata(preview_since = "0.12.0")]
|
||||
#[violation_metadata(stable_since = "0.15.0")]
|
||||
pub(crate) struct LegacyFormPytestRaises {
|
||||
context_type: PytestContextType,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user