From dfe1b849d0512916bce655f4195d91f3a64799c6 Mon Sep 17 00:00:00 2001 From: InSync Date: Mon, 3 Feb 2025 21:33:03 +0700 Subject: [PATCH] Convert `.md` links in rule documentation to full URLs (#15904) --- .../flake8_type_checking/rules/type_alias_quotes.rs | 6 ++++-- .../pyupgrade/rules/pep695/non_pep695_generic_class.rs | 9 ++++++--- .../rules/pep695/non_pep695_generic_function.rs | 6 ++++-- .../src/rules/pyupgrade/rules/quoted_annotation.rs | 7 +++++-- 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/rules/type_alias_quotes.rs b/crates/ruff_linter/src/rules/flake8_type_checking/rules/type_alias_quotes.rs index af7fa05b14..ae94a2b9a9 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/rules/type_alias_quotes.rs +++ b/crates/ruff_linter/src/rules/flake8_type_checking/rules/type_alias_quotes.rs @@ -113,9 +113,9 @@ impl Violation for UnquotedTypeAlias { /// This rule only applies to type aliases in non-stub files. For removing quotes in other /// contexts or in stub files, see: /// -/// - [`quoted-annotation-in-stub`](quoted-annotation-in-stub.md): A rule that +/// - [`quoted-annotation-in-stub`][PYI020]: A rule that /// removes all quoted annotations from stub files -/// - [`quoted-annotation`](quoted-annotation.md): A rule that removes unnecessary quotes +/// - [`quoted-annotation`][UP037]: A rule that removes unnecessary quotes /// from *annotations* in runtime files. /// /// ## References @@ -126,6 +126,8 @@ impl Violation for UnquotedTypeAlias { /// [PEP 604]: https://peps.python.org/pep-0604/ /// [PEP 613]: https://peps.python.org/pep-0613/ /// [PEP 695]: https://peps.python.org/pep-0695/#generic-type-alias +/// [PYI020]: https://docs.astral.sh/ruff/rules/quoted-annotation-in-stub/ +/// [UP037]: https://docs.astral.sh/ruff/rules/quoted-annotation/ #[derive(ViolationMetadata)] pub(crate) struct QuotedTypeAlias; diff --git a/crates/ruff_linter/src/rules/pyupgrade/rules/pep695/non_pep695_generic_class.rs b/crates/ruff_linter/src/rules/pyupgrade/rules/pep695/non_pep695_generic_class.rs index 5c29f31cfc..843ec5217a 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/rules/pep695/non_pep695_generic_class.rs +++ b/crates/ruff_linter/src/rules/pyupgrade/rules/pep695/non_pep695_generic_class.rs @@ -62,19 +62,22 @@ use super::{check_type_vars, in_nested_context, DisplayTypeVars, TypeVarReferenc /// /// This rule replaces standalone type variables in classes but doesn't remove /// the corresponding type variables even if they are unused after the fix. See -/// [`unused-private-type-var`](unused-private-type-var.md) for a rule to clean up unused +/// [`unused-private-type-var`][PYI018] for a rule to clean up unused /// private type variables. /// /// This rule will correctly handle classes with multiple base classes, as long as the single /// `Generic` base class is at the end of the argument list, as checked by -/// [`generic-not-last-base-class`](generic-not-last-base-class.md). If a `Generic` base class is +/// [`generic-not-last-base-class`][PYI059]. If a `Generic` base class is /// found outside of the last position, a diagnostic is emitted without a suggested fix. /// /// This rule only applies to generic classes and does not include generic functions. See -/// [`non-pep695-generic-function`](non-pep695-generic-function.md) for the function version. +/// [`non-pep695-generic-function`][PYI059] for the function version. /// /// [PEP 695]: https://peps.python.org/pep-0695/ /// [PEP 696]: https://peps.python.org/pep-0696/ +/// [PYI018]: https://docs.astral.sh/ruff/rules/unused-private-type-var/ +/// [PYI059]: https://docs.astral.sh/ruff/rules/generic-not-last-base-class/ +/// [PYI059]: https://docs.astral.sh/ruff/rules/non-pep695-generic-function/ #[derive(ViolationMetadata)] pub(crate) struct NonPEP695GenericClass { name: String, diff --git a/crates/ruff_linter/src/rules/pyupgrade/rules/pep695/non_pep695_generic_function.rs b/crates/ruff_linter/src/rules/pyupgrade/rules/pep695/non_pep695_generic_function.rs index f1109dd8a0..58f09c9caa 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/rules/pep695/non_pep695_generic_function.rs +++ b/crates/ruff_linter/src/rules/pyupgrade/rules/pep695/non_pep695_generic_function.rs @@ -61,14 +61,16 @@ use super::{check_type_vars, in_nested_context, DisplayTypeVars, TypeVarReferenc /// /// This rule replaces standalone type variables in function signatures but doesn't remove /// the corresponding type variables even if they are unused after the fix. See -/// [`unused-private-type-var`](unused-private-type-var.md) for a rule to clean up unused +/// [`unused-private-type-var`][PYI018] for a rule to clean up unused /// private type variables. /// /// This rule only applies to generic functions and does not include generic classes. See -/// [`non-pep695-generic-class`](non-pep695-generic-class.md) for the class version. +/// [`non-pep695-generic-class`][UP046] for the class version. /// /// [PEP 695]: https://peps.python.org/pep-0695/ /// [PEP 696]: https://peps.python.org/pep-0696/ +/// [PYI018]: https://docs.astral.sh/ruff/rules/unused-private-type-var/ +/// [UP046]: https://docs.astral.sh/ruff/rules/non-pep695-generic-class/ #[derive(ViolationMetadata)] pub(crate) struct NonPEP695GenericFunction { name: String, diff --git a/crates/ruff_linter/src/rules/pyupgrade/rules/quoted_annotation.rs b/crates/ruff_linter/src/rules/pyupgrade/rules/quoted_annotation.rs index fa3546bd5e..c1a4022716 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/rules/quoted_annotation.rs +++ b/crates/ruff_linter/src/rules/pyupgrade/rules/quoted_annotation.rs @@ -58,14 +58,17 @@ use ruff_source_file::LineRanges; /// ``` /// /// ## See also -/// - [`quoted-annotation-in-stub`](quoted-annotation-in-stub.md): A rule that +/// - [`quoted-annotation-in-stub`][PYI020]: A rule that /// removes all quoted annotations from stub files -/// - [`quoted-type-alias`](quoted-type-alias.md): A rule that removes unnecessary quotes +/// - [`quoted-type-alias`][TC008]: A rule that removes unnecessary quotes /// from type aliases. /// /// ## References /// - [PEP 563 – Postponed Evaluation of Annotations](https://peps.python.org/pep-0563/) /// - [Python documentation: `__future__`](https://docs.python.org/3/library/__future__.html#module-__future__) +/// +/// [PYI020]: https://docs.astral.sh/ruff/rules/quoted-annotation-in-stub/ +/// [TC008]: https://docs.astral.sh/ruff/rules/quoted-type-alias/ #[derive(ViolationMetadata)] pub(crate) struct QuotedAnnotation;