From dc51d03866903745fd24dcf48ad91f1e3d533ee2 Mon Sep 17 00:00:00 2001 From: Tom Kuson Date: Fri, 29 Sep 2023 17:48:51 +0100 Subject: [PATCH] Fix documentation for `no-return-argument-annotation-in-stub` [`PYI050`] (#7708) ## Summary The markdown documentation was present, but in the wrong place, so was not displaying on the website. I moved it and added some references. Related to #2646. ## Test Plan `python scripts/check_docs_formatted.py` --- .../rules/no_return_argument_annotation.rs | 14 +++++++++----- scripts/check_docs_formatted.py | 1 + 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/crates/ruff_linter/src/rules/flake8_pyi/rules/no_return_argument_annotation.rs b/crates/ruff_linter/src/rules/flake8_pyi/rules/no_return_argument_annotation.rs index 7dd300115b..f10946236b 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/rules/no_return_argument_annotation.rs +++ b/crates/ruff_linter/src/rules/flake8_pyi/rules/no_return_argument_annotation.rs @@ -8,11 +8,6 @@ use ruff_text_size::Ranged; use crate::checkers::ast::Checker; use crate::settings::types::PythonVersion::Py311; -#[violation] -pub struct NoReturnArgumentAnnotationInStub { - module: TypingModule, -} - /// ## What it does /// Checks for uses of `typing.NoReturn` (and `typing_extensions.NoReturn`) in /// stubs. @@ -37,6 +32,15 @@ pub struct NoReturnArgumentAnnotationInStub { /// /// def foo(x: Never): ... /// ``` +/// +/// ## References +/// - [Python documentation: `typing.Never`](https://docs.python.org/3/library/typing.html#typing.Never) +/// - [Python documentation: `typing.NoReturn`](https://docs.python.org/3/library/typing.html#typing.NoReturn) +#[violation] +pub struct NoReturnArgumentAnnotationInStub { + module: TypingModule, +} + impl Violation for NoReturnArgumentAnnotationInStub { #[derive_message_formats] fn message(&self) -> String { diff --git a/scripts/check_docs_formatted.py b/scripts/check_docs_formatted.py index bc6f93010c..b1d09ab068 100755 --- a/scripts/check_docs_formatted.py +++ b/scripts/check_docs_formatted.py @@ -55,6 +55,7 @@ KNOWN_FORMATTING_VIOLATIONS = [ "multiple-statements-on-one-line-semicolon", "no-blank-line-before-function", "no-indented-block-comment", + "no-return-argument-annotation-in-stub", "no-space-after-block-comment", "no-space-after-inline-comment", "non-empty-stub-body",