Fix PT005 doc (#6596)

This commit is contained in:
Harutaka Kawamura 2023-08-15 21:48:44 +09:00 committed by GitHub
parent b1c4c7be69
commit 81b1176f99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 8 deletions

View File

@ -213,6 +213,14 @@ pub struct PytestMissingFixtureNameUnderscore {
function: String, function: String,
} }
impl Violation for PytestMissingFixtureNameUnderscore {
#[derive_message_formats]
fn message(&self) -> String {
let PytestMissingFixtureNameUnderscore { function } = self;
format!("Fixture `{function}` does not return anything, add leading underscore")
}
}
/// ## What it does /// ## What it does
/// Checks for `pytest` fixtures that return a value, but are named with a /// Checks for `pytest` fixtures that return a value, but are named with a
/// leading underscore. /// leading underscore.
@ -259,14 +267,6 @@ pub struct PytestMissingFixtureNameUnderscore {
/// ///
/// ## References /// ## References
/// - [`pytest` documentation: `@pytest.fixture` functions](https://docs.pytest.org/en/latest/reference/reference.html#pytest-fixture) /// - [`pytest` documentation: `@pytest.fixture` functions](https://docs.pytest.org/en/latest/reference/reference.html#pytest-fixture)
impl Violation for PytestMissingFixtureNameUnderscore {
#[derive_message_formats]
fn message(&self) -> String {
let PytestMissingFixtureNameUnderscore { function } = self;
format!("Fixture `{function}` does not return anything, add leading underscore")
}
}
#[violation] #[violation]
pub struct PytestIncorrectFixtureNameUnderscore { pub struct PytestIncorrectFixtureNameUnderscore {
function: String, function: String,