From 4f8f9892805483a72b0c957527eeb3e128eb1db4 Mon Sep 17 00:00:00 2001 From: Muspi Merol Date: Tue, 25 Feb 2025 15:10:10 +0800 Subject: [PATCH 1/3] Replace `Examples` with `Example` --- .../rules/flake8_bugbear/rules/reuse_of_groupby_generator.rs | 2 +- .../rules/unnecessary_call_around_sorted.rs | 2 +- .../flake8_comprehensions/rules/unnecessary_collection_call.rs | 2 +- .../flake8_comprehensions/rules/unnecessary_comprehension.rs | 2 +- .../rules/unnecessary_comprehension_in_call.rs | 2 +- .../rules/unnecessary_dict_comprehension_for_iterable.rs | 2 +- .../rules/unnecessary_double_cast_or_process.rs | 2 +- .../flake8_comprehensions/rules/unnecessary_generator_dict.rs | 2 +- .../flake8_comprehensions/rules/unnecessary_generator_list.rs | 2 +- .../flake8_comprehensions/rules/unnecessary_generator_set.rs | 2 +- .../rules/flake8_comprehensions/rules/unnecessary_list_call.rs | 2 +- .../rules/unnecessary_list_comprehension_dict.rs | 2 +- .../rules/unnecessary_list_comprehension_set.rs | 2 +- .../flake8_comprehensions/rules/unnecessary_literal_dict.rs | 2 +- .../flake8_comprehensions/rules/unnecessary_literal_set.rs | 2 +- .../rules/unnecessary_literal_within_dict_call.rs | 2 +- .../rules/unnecessary_literal_within_list_call.rs | 2 +- .../rules/unnecessary_literal_within_tuple_call.rs | 2 +- .../src/rules/flake8_comprehensions/rules/unnecessary_map.rs | 2 +- .../rules/unnecessary_subscript_reversal.rs | 2 +- .../flake8_django/rules/unordered_body_content_in_model.rs | 2 +- .../flake8_use_pathlib/rules/invalid_pathlib_with_suffix.rs | 2 +- .../src/rules/flake8_use_pathlib/rules/os_path_getatime.rs | 2 +- .../src/rules/flake8_use_pathlib/rules/os_path_getctime.rs | 2 +- .../src/rules/flake8_use_pathlib/rules/os_path_getmtime.rs | 2 +- .../src/rules/flake8_use_pathlib/rules/os_path_getsize.rs | 2 +- crates/ruff_linter/src/rules/numpy/rules/deprecated_function.rs | 2 +- .../ruff_linter/src/rules/numpy/rules/deprecated_type_alias.rs | 2 +- crates/ruff_linter/src/rules/numpy/rules/legacy_random.rs | 2 +- .../ruff_linter/src/rules/numpy/rules/numpy_2_0_deprecation.rs | 2 +- .../src/rules/pyupgrade/rules/unnecessary_class_parentheses.rs | 2 +- .../src/rules/pyupgrade/rules/unnecessary_default_type_args.rs | 2 +- .../src/rules/refurb/rules/unnecessary_from_float.rs | 2 +- crates/ruff_linter/src/rules/ruff/rules/assignment_in_assert.rs | 2 +- .../ruff_linter/src/rules/ruff/rules/default_factory_kwarg.rs | 2 +- .../src/rules/ruff/rules/function_call_in_dataclass_default.rs | 2 +- .../rules/ruff/rules/invalid_formatter_suppression_comment.rs | 2 +- .../src/rules/ruff/rules/mutable_dataclass_default.rs | 2 +- .../ruff_linter/src/rules/ruff/rules/unnecessary_key_check.rs | 2 +- .../rules/ruff/rules/unnecessary_literal_within_deque_call.rs | 2 +- crates/ruff_linter/src/rules/ruff/rules/unused_async.rs | 2 +- 41 files changed, 41 insertions(+), 41 deletions(-) diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/rules/reuse_of_groupby_generator.rs b/crates/ruff_linter/src/rules/flake8_bugbear/rules/reuse_of_groupby_generator.rs index 18487040d1ab7..0e70f8aa222d0 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/rules/reuse_of_groupby_generator.rs +++ b/crates/ruff_linter/src/rules/flake8_bugbear/rules/reuse_of_groupby_generator.rs @@ -15,7 +15,7 @@ use crate::checkers::ast::Checker; /// Using the generator more than once will do nothing on the second usage. /// If that data is needed later, it should be stored as a list. /// -/// ## Examples: +/// ## Example: /// ```python /// import itertools /// diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_call_around_sorted.rs b/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_call_around_sorted.rs index 70794a9304988..13dc4920865aa 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_call_around_sorted.rs +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_call_around_sorted.rs @@ -21,7 +21,7 @@ use crate::rules::flake8_comprehensions::fixes; /// /// In both cases, it's clearer and more efficient to avoid the redundant call. /// -/// ## Examples +/// ## Example /// ```python /// reversed(sorted(iterable)) /// ``` diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_collection_call.rs b/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_collection_call.rs index dc16511336005..510d73bddb660 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_collection_call.rs +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_collection_call.rs @@ -17,7 +17,7 @@ use crate::rules::flake8_comprehensions::settings::Settings; /// literal (`{}`). The former is slower because the name `dict` must be /// looked up in the global scope in case it has been rebound. /// -/// ## Examples +/// ## Example /// ```python /// dict() /// dict(a=1, b=2) diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_comprehension.rs b/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_comprehension.rs index a9d411feee839..922e00023406f 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_comprehension.rs +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_comprehension.rs @@ -15,7 +15,7 @@ use crate::rules::flake8_comprehensions::fixes; /// It's unnecessary to use a dict/list/set comprehension to build a data structure if the /// elements are unchanged. Wrap the iterable with `dict()`, `list()`, or `set()` instead. /// -/// ## Examples +/// ## Example /// ```python /// {a: b for a, b in iterable} /// [x for x in iterable] diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_comprehension_in_call.rs b/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_comprehension_in_call.rs index aa3826dd042bc..cfa611e7deb61 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_comprehension_in_call.rs +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_comprehension_in_call.rs @@ -41,7 +41,7 @@ use crate::rules::flake8_comprehensions::fixes; /// short-circuiting it may not improve performance. (It may even slightly regress performance, /// though the difference will usually be small.) /// -/// ## Examples +/// ## Example /// ```python /// any([x.id for x in bar]) /// all([x.id for x in bar]) diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_dict_comprehension_for_iterable.rs b/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_dict_comprehension_for_iterable.rs index e30843c1b3e33..7f56ecfaeb03c 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_dict_comprehension_for_iterable.rs +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_dict_comprehension_for_iterable.rs @@ -19,7 +19,7 @@ use crate::checkers::ast::Checker; /// Prefer `dict.fromkeys(iterable)` over `{value: None for value in iterable}`, /// as `dict.fromkeys` is more readable and efficient. /// -/// ## Examples +/// ## Example /// ```python /// {a: None for a in iterable} /// {a: 1 for a in iterable} diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_double_cast_or_process.rs b/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_double_cast_or_process.rs index 4ce5712802e90..48a16d57e3d58 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_double_cast_or_process.rs +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_double_cast_or_process.rs @@ -17,7 +17,7 @@ use crate::rules::flake8_comprehensions::fixes; /// the listed functions within an additional `list()`, `set()`, `sorted()`, or /// `tuple()` call. Doing so is redundant and can be confusing for readers. /// -/// ## Examples +/// ## Example /// ```python /// list(tuple(iterable)) /// ``` diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_generator_dict.rs b/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_generator_dict.rs index 6b03d813b87b6..ea7f036eeb8c5 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_generator_dict.rs +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_generator_dict.rs @@ -18,7 +18,7 @@ use super::helpers; /// there are equivalent comprehensions for these types. Using a /// comprehension is clearer and more idiomatic. /// -/// ## Examples +/// ## Example /// ```python /// dict((x, f(x)) for x in foo) /// ``` diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_generator_list.rs b/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_generator_list.rs index c2345fdcced1f..e2739c5ab719f 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_generator_list.rs +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_generator_list.rs @@ -24,7 +24,7 @@ use super::helpers; /// `list(x for x in foo)`, it's better to use `list(foo)` directly, since it's /// even more direct. /// -/// ## Examples +/// ## Example /// ```python /// list(f(x) for x in foo) /// list(x for x in foo) diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_generator_set.rs b/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_generator_set.rs index e04c67cb94272..4582a274acf68 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_generator_set.rs +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_generator_set.rs @@ -25,7 +25,7 @@ use super::helpers; /// `set(x for x in foo)`, it's better to use `set(foo)` directly, since it's /// even more direct. /// -/// ## Examples +/// ## Example /// ```python /// set(f(x) for x in foo) /// set(x for x in foo) diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_list_call.rs b/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_list_call.rs index f5d3bf84b5b98..851c4be16a1df 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_list_call.rs +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_list_call.rs @@ -16,7 +16,7 @@ use super::helpers; /// ## Why is this bad? /// It is redundant to use a `list()` call around a list comprehension. /// -/// ## Examples +/// ## Example /// ```python /// list([f(x) for x in foo]) /// ``` diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_list_comprehension_dict.rs b/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_list_comprehension_dict.rs index 183a065d75598..4bad3a17ca486 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_list_comprehension_dict.rs +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_list_comprehension_dict.rs @@ -16,7 +16,7 @@ use super::helpers; /// It's unnecessary to use a list comprehension inside a call to `dict()`, /// since there is an equivalent comprehension for this type. /// -/// ## Examples +/// ## Example /// ```python /// dict([(x, f(x)) for x in foo]) /// ``` diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_list_comprehension_set.rs b/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_list_comprehension_set.rs index 4a91ff7c5ea9f..be2c56329568e 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_list_comprehension_set.rs +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_list_comprehension_set.rs @@ -17,7 +17,7 @@ use super::helpers; /// It's unnecessary to use a list comprehension inside a call to `set()`, /// since there is an equivalent comprehension for this type. /// -/// ## Examples +/// ## Example /// ```python /// set([f(x) for x in foo]) /// ``` diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_literal_dict.rs b/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_literal_dict.rs index c47e445766198..3ccfccda35e5b 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_literal_dict.rs +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_literal_dict.rs @@ -16,7 +16,7 @@ use super::helpers; /// It's unnecessary to use a list or tuple literal within a call to `dict()`. /// It can be rewritten as a dict literal (`{}`). /// -/// ## Examples +/// ## Example /// ```python /// dict([(1, 2), (3, 4)]) /// dict(((1, 2), (3, 4))) diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_literal_set.rs b/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_literal_set.rs index 85fdfcee9b9fe..31f33bf5208c6 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_literal_set.rs +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_literal_set.rs @@ -16,7 +16,7 @@ use super::helpers; /// It's unnecessary to use a list or tuple literal within a call to `set()`. /// Instead, the expression can be rewritten as a set literal. /// -/// ## Examples +/// ## Example /// ```python /// set([1, 2]) /// set((1, 2)) diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_literal_within_dict_call.rs b/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_literal_within_dict_call.rs index 37e377f9bca74..7b24cb8d9f2c6 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_literal_within_dict_call.rs +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_literal_within_dict_call.rs @@ -19,7 +19,7 @@ use super::helpers; /// call, since the literal or comprehension syntax already returns a /// dictionary. /// -/// ## Examples +/// ## Example /// ```python /// dict({}) /// dict({"a": 1}) diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_literal_within_list_call.rs b/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_literal_within_list_call.rs index 97e52666d70a8..72bad6b12fc29 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_literal_within_list_call.rs +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_literal_within_list_call.rs @@ -19,7 +19,7 @@ use super::helpers; /// removed. Otherwise, if a tuple literal is passed in, then it should be /// rewritten as a list literal. /// -/// ## Examples +/// ## Example /// ```python /// list([1, 2]) /// list((1, 2)) diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_literal_within_tuple_call.rs b/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_literal_within_tuple_call.rs index d39d3d473313d..50a44a31f5d3a 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_literal_within_tuple_call.rs +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_literal_within_tuple_call.rs @@ -27,7 +27,7 @@ use super::helpers; /// calls. If a list comprehension is found, it should be rewritten as a /// generator expression. /// -/// ## Examples +/// ## Example /// ```python /// tuple([1, 2]) /// tuple((1, 2)) diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_map.rs b/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_map.rs index 89da8a12d8795..394c045d48671 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_map.rs +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_map.rs @@ -30,7 +30,7 @@ use crate::rules::flake8_comprehensions::fixes; /// - Instead of `dict(map(lambda v: (v, v ** 2), values))`, use /// `{v: v ** 2 for v in values}`. /// -/// ## Examples +/// ## Example /// ```python /// map(lambda x: x + 1, iterable) /// ``` diff --git a/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_subscript_reversal.rs b/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_subscript_reversal.rs index e7bae7b70057f..77a1d98070390 100644 --- a/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_subscript_reversal.rs +++ b/crates/ruff_linter/src/rules/flake8_comprehensions/rules/unnecessary_subscript_reversal.rs @@ -13,7 +13,7 @@ use crate::checkers::ast::Checker; /// into `reversed()`, `set()` or `sorted()` functions as they will change /// the order of the elements again. /// -/// ## Examples +/// ## Example /// ```python /// sorted(iterable[::-1]) /// set(iterable[::-1]) diff --git a/crates/ruff_linter/src/rules/flake8_django/rules/unordered_body_content_in_model.rs b/crates/ruff_linter/src/rules/flake8_django/rules/unordered_body_content_in_model.rs index 71a2a5a2a5bd1..fa4c994c73e7c 100644 --- a/crates/ruff_linter/src/rules/flake8_django/rules/unordered_body_content_in_model.rs +++ b/crates/ruff_linter/src/rules/flake8_django/rules/unordered_body_content_in_model.rs @@ -27,7 +27,7 @@ use super::helpers; /// 6. `def get_absolute_url()` /// 7. Any custom methods /// -/// ## Examples +/// ## Example /// ```python /// from django.db import models /// diff --git a/crates/ruff_linter/src/rules/flake8_use_pathlib/rules/invalid_pathlib_with_suffix.rs b/crates/ruff_linter/src/rules/flake8_use_pathlib/rules/invalid_pathlib_with_suffix.rs index 142650ed6a395..d927d150f20c3 100644 --- a/crates/ruff_linter/src/rules/flake8_use_pathlib/rules/invalid_pathlib_with_suffix.rs +++ b/crates/ruff_linter/src/rules/flake8_use_pathlib/rules/invalid_pathlib_with_suffix.rs @@ -16,7 +16,7 @@ use ruff_text_size::Ranged; /// if the given suffix is not prefixed with a dot /// or it is a single dot `"."`. /// -/// ## Examples +/// ## Example /// /// ```python /// path.with_suffix("py") diff --git a/crates/ruff_linter/src/rules/flake8_use_pathlib/rules/os_path_getatime.rs b/crates/ruff_linter/src/rules/flake8_use_pathlib/rules/os_path_getatime.rs index 15da2eb4163fd..d4645dcbcea05 100644 --- a/crates/ruff_linter/src/rules/flake8_use_pathlib/rules/os_path_getatime.rs +++ b/crates/ruff_linter/src/rules/flake8_use_pathlib/rules/os_path_getatime.rs @@ -12,7 +12,7 @@ use ruff_macros::{derive_message_formats, ViolationMetadata}; /// improve readability over the `os.path` module's counterparts (e.g., /// `os.path.getatime()`). /// -/// ## Examples +/// ## Example /// ```python /// import os /// diff --git a/crates/ruff_linter/src/rules/flake8_use_pathlib/rules/os_path_getctime.rs b/crates/ruff_linter/src/rules/flake8_use_pathlib/rules/os_path_getctime.rs index 0eae426b35324..8c645f2994797 100644 --- a/crates/ruff_linter/src/rules/flake8_use_pathlib/rules/os_path_getctime.rs +++ b/crates/ruff_linter/src/rules/flake8_use_pathlib/rules/os_path_getctime.rs @@ -12,7 +12,7 @@ use ruff_macros::{derive_message_formats, ViolationMetadata}; /// improve readability over the `os.path` module's counterparts (e.g., /// `os.path.getctime()`). /// -/// ## Examples +/// ## Example /// ```python /// import os /// diff --git a/crates/ruff_linter/src/rules/flake8_use_pathlib/rules/os_path_getmtime.rs b/crates/ruff_linter/src/rules/flake8_use_pathlib/rules/os_path_getmtime.rs index dbc1f1d50022f..9237a307b0384 100644 --- a/crates/ruff_linter/src/rules/flake8_use_pathlib/rules/os_path_getmtime.rs +++ b/crates/ruff_linter/src/rules/flake8_use_pathlib/rules/os_path_getmtime.rs @@ -12,7 +12,7 @@ use ruff_macros::{derive_message_formats, ViolationMetadata}; /// improve readability over the `os.path` module's counterparts (e.g., /// `os.path.getmtime()`). /// -/// ## Examples +/// ## Example /// ```python /// import os /// diff --git a/crates/ruff_linter/src/rules/flake8_use_pathlib/rules/os_path_getsize.rs b/crates/ruff_linter/src/rules/flake8_use_pathlib/rules/os_path_getsize.rs index 94b5b793ee306..b642783023469 100644 --- a/crates/ruff_linter/src/rules/flake8_use_pathlib/rules/os_path_getsize.rs +++ b/crates/ruff_linter/src/rules/flake8_use_pathlib/rules/os_path_getsize.rs @@ -12,7 +12,7 @@ use ruff_macros::{derive_message_formats, ViolationMetadata}; /// improve readability over the `os.path` module's counterparts (e.g., /// `os.path.getsize()`). /// -/// ## Examples +/// ## Example /// ```python /// import os /// diff --git a/crates/ruff_linter/src/rules/numpy/rules/deprecated_function.rs b/crates/ruff_linter/src/rules/numpy/rules/deprecated_function.rs index 06a61d9373bd7..caf6afc133ab2 100644 --- a/crates/ruff_linter/src/rules/numpy/rules/deprecated_function.rs +++ b/crates/ruff_linter/src/rules/numpy/rules/deprecated_function.rs @@ -17,7 +17,7 @@ use crate::importer::ImportRequest; /// /// Prefer newer APIs over deprecated ones. /// -/// ## Examples +/// ## Example /// ```python /// import numpy as np /// diff --git a/crates/ruff_linter/src/rules/numpy/rules/deprecated_type_alias.rs b/crates/ruff_linter/src/rules/numpy/rules/deprecated_type_alias.rs index 675a6692688cd..3e5ee760a090a 100644 --- a/crates/ruff_linter/src/rules/numpy/rules/deprecated_type_alias.rs +++ b/crates/ruff_linter/src/rules/numpy/rules/deprecated_type_alias.rs @@ -19,7 +19,7 @@ use crate::checkers::ast::Checker; /// Note, however, that `np.bool` and `np.long` were reintroduced in 2.0 with /// different semantics, and are thus omitted from this rule. /// -/// ## Examples +/// ## Example /// ```python /// import numpy as np /// diff --git a/crates/ruff_linter/src/rules/numpy/rules/legacy_random.rs b/crates/ruff_linter/src/rules/numpy/rules/legacy_random.rs index 4174d8e6e3bd8..9be089f24a8d9 100644 --- a/crates/ruff_linter/src/rules/numpy/rules/legacy_random.rs +++ b/crates/ruff_linter/src/rules/numpy/rules/legacy_random.rs @@ -28,7 +28,7 @@ use crate::checkers::ast::Checker; /// See the documentation on [Random Sampling] and [NEP 19] for further /// details. /// -/// ## Examples +/// ## Example /// ```python /// import numpy as np /// diff --git a/crates/ruff_linter/src/rules/numpy/rules/numpy_2_0_deprecation.rs b/crates/ruff_linter/src/rules/numpy/rules/numpy_2_0_deprecation.rs index e5f7be5479331..730a6a5137342 100644 --- a/crates/ruff_linter/src/rules/numpy/rules/numpy_2_0_deprecation.rs +++ b/crates/ruff_linter/src/rules/numpy/rules/numpy_2_0_deprecation.rs @@ -31,7 +31,7 @@ use crate::importer::ImportRequest; /// This rule flags all uses of removed members, along with automatic fixes for /// any backwards-compatible replacements. /// -/// ## Examples +/// ## Example /// ```python /// import numpy as np /// diff --git a/crates/ruff_linter/src/rules/pyupgrade/rules/unnecessary_class_parentheses.rs b/crates/ruff_linter/src/rules/pyupgrade/rules/unnecessary_class_parentheses.rs index d671e0c33751b..832272d5f5334 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/rules/unnecessary_class_parentheses.rs +++ b/crates/ruff_linter/src/rules/pyupgrade/rules/unnecessary_class_parentheses.rs @@ -13,7 +13,7 @@ use crate::checkers::ast::Checker; /// If a class definition doesn't have any bases, the parentheses are /// unnecessary. /// -/// ## Examples +/// ## Example /// ```python /// class Foo(): /// ... diff --git a/crates/ruff_linter/src/rules/pyupgrade/rules/unnecessary_default_type_args.rs b/crates/ruff_linter/src/rules/pyupgrade/rules/unnecessary_default_type_args.rs index 4a994f7b6b8c2..b95125b5158bc 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/rules/unnecessary_default_type_args.rs +++ b/crates/ruff_linter/src/rules/pyupgrade/rules/unnecessary_default_type_args.rs @@ -20,7 +20,7 @@ use crate::checkers::ast::Checker; /// Omitting type arguments that match the default values can make the code /// more concise and easier to read. /// -/// ## Examples +/// ## Example /// /// ```python /// from collections.abc import Generator, AsyncGenerator diff --git a/crates/ruff_linter/src/rules/refurb/rules/unnecessary_from_float.rs b/crates/ruff_linter/src/rules/refurb/rules/unnecessary_from_float.rs index 60cf8233b8562..0d07fae3ce9a6 100644 --- a/crates/ruff_linter/src/rules/refurb/rules/unnecessary_from_float.rs +++ b/crates/ruff_linter/src/rules/refurb/rules/unnecessary_from_float.rs @@ -15,7 +15,7 @@ use crate::checkers::ast::Checker; /// the use of `from_float` and `from_decimal` methods is unnecessary, and /// should be avoided in favor of the more concise constructor syntax. /// -/// ## Examples +/// ## Example /// ```python /// Decimal.from_float(4.2) /// Decimal.from_float(float("inf")) diff --git a/crates/ruff_linter/src/rules/ruff/rules/assignment_in_assert.rs b/crates/ruff_linter/src/rules/ruff/rules/assignment_in_assert.rs index 792f71dd3e0eb..69d098457af49 100644 --- a/crates/ruff_linter/src/rules/ruff/rules/assignment_in_assert.rs +++ b/crates/ruff_linter/src/rules/ruff/rules/assignment_in_assert.rs @@ -19,7 +19,7 @@ use crate::checkers::ast::Checker; /// which may result in unexpected behavior (e.g., undefined variable /// accesses). /// -/// ## Examples +/// ## Example /// ```python /// assert (x := 0) == 0 /// print(x) diff --git a/crates/ruff_linter/src/rules/ruff/rules/default_factory_kwarg.rs b/crates/ruff_linter/src/rules/ruff/rules/default_factory_kwarg.rs index 14613afe1253a..fc5cc0aaa64ba 100644 --- a/crates/ruff_linter/src/rules/ruff/rules/default_factory_kwarg.rs +++ b/crates/ruff_linter/src/rules/ruff/rules/default_factory_kwarg.rs @@ -38,7 +38,7 @@ use crate::Locator; /// keyword to a positional argument will change the behavior of the code, even /// if the keyword argument was used erroneously. /// -/// ## Examples +/// ## Example /// ```python /// defaultdict(default_factory=int) /// defaultdict(default_factory=list) diff --git a/crates/ruff_linter/src/rules/ruff/rules/function_call_in_dataclass_default.rs b/crates/ruff_linter/src/rules/ruff/rules/function_call_in_dataclass_default.rs index 7a514d61fbf00..71e6331d655bd 100644 --- a/crates/ruff_linter/src/rules/ruff/rules/function_call_in_dataclass_default.rs +++ b/crates/ruff_linter/src/rules/ruff/rules/function_call_in_dataclass_default.rs @@ -29,7 +29,7 @@ use crate::rules::ruff::rules::helpers::{ /// Attributes whose default arguments are `NewType` calls /// where the original type is immutable are ignored. /// -/// ## Examples +/// ## Example /// ```python /// from dataclasses import dataclass /// diff --git a/crates/ruff_linter/src/rules/ruff/rules/invalid_formatter_suppression_comment.rs b/crates/ruff_linter/src/rules/ruff/rules/invalid_formatter_suppression_comment.rs index 887e05df05848..b3fac6e6ca292 100644 --- a/crates/ruff_linter/src/rules/ruff/rules/invalid_formatter_suppression_comment.rs +++ b/crates/ruff_linter/src/rules/ruff/rules/invalid_formatter_suppression_comment.rs @@ -26,7 +26,7 @@ use super::suppression_comment_visitor::{ /// Suppression comments that do not actually prevent formatting could cause unintended changes /// when the formatter is run. /// -/// ## Examples +/// ## Example /// In the following example, all suppression comments would cause /// a rule violation. /// diff --git a/crates/ruff_linter/src/rules/ruff/rules/mutable_dataclass_default.rs b/crates/ruff_linter/src/rules/ruff/rules/mutable_dataclass_default.rs index 9cec4913dd591..341af13c67304 100644 --- a/crates/ruff_linter/src/rules/ruff/rules/mutable_dataclass_default.rs +++ b/crates/ruff_linter/src/rules/ruff/rules/mutable_dataclass_default.rs @@ -22,7 +22,7 @@ use crate::rules::ruff::rules::helpers::{dataclass_kind, is_class_var_annotation /// If the default value is intended to be mutable, it must be annotated with /// `typing.ClassVar`; otherwise, a `ValueError` will be raised. /// -/// ## Examples +/// ## Example /// ```python /// from dataclasses import dataclass /// diff --git a/crates/ruff_linter/src/rules/ruff/rules/unnecessary_key_check.rs b/crates/ruff_linter/src/rules/ruff/rules/unnecessary_key_check.rs index 6957d191d2da9..4a443fa1997f0 100644 --- a/crates/ruff_linter/src/rules/ruff/rules/unnecessary_key_check.rs +++ b/crates/ruff_linter/src/rules/ruff/rules/unnecessary_key_check.rs @@ -17,7 +17,7 @@ use crate::checkers::ast::Checker; /// without having to check if the dictionary contains the relevant key, /// returning `None` if the key is not present. /// -/// ## Examples +/// ## Example /// ```python /// if "key" in dct and dct["key"]: /// ... diff --git a/crates/ruff_linter/src/rules/ruff/rules/unnecessary_literal_within_deque_call.rs b/crates/ruff_linter/src/rules/ruff/rules/unnecessary_literal_within_deque_call.rs index b9b51cfec38fa..47b3f712adda0 100644 --- a/crates/ruff_linter/src/rules/ruff/rules/unnecessary_literal_within_deque_call.rs +++ b/crates/ruff_linter/src/rules/ruff/rules/unnecessary_literal_within_deque_call.rs @@ -10,7 +10,7 @@ use ruff_text_size::Ranged; /// ## Why is this bad? /// It's unnecessary to use an empty literal as a deque's iterable, since this is already the default behavior. /// -/// ## Examples +/// ## Example /// /// ```python /// from collections import deque diff --git a/crates/ruff_linter/src/rules/ruff/rules/unused_async.rs b/crates/ruff_linter/src/rules/ruff/rules/unused_async.rs index 6ef9495c60e4d..e3fb4cb8d960c 100644 --- a/crates/ruff_linter/src/rules/ruff/rules/unused_async.rs +++ b/crates/ruff_linter/src/rules/ruff/rules/unused_async.rs @@ -18,7 +18,7 @@ use crate::rules::fastapi::rules::is_fastapi_route; /// contexts where that function may be called. In some cases, labeling a function `async` is /// semantically meaningful (e.g. with the trio library). /// -/// ## Examples +/// ## Example /// ```python /// async def foo(): /// bar() From 4adfd81ff66037ce0520a6985e7382ce1049c339 Mon Sep 17 00:00:00 2001 From: Muspi Merol Date: Tue, 25 Feb 2025 15:39:59 +0800 Subject: [PATCH 2/3] Remove trailing `?` for `What it does` --- .../ruff_linter/src/rules/flake8_pyi/rules/simple_defaults.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/ruff_linter/src/rules/flake8_pyi/rules/simple_defaults.rs b/crates/ruff_linter/src/rules/flake8_pyi/rules/simple_defaults.rs index 3f0577928f7d2..2e8035af0777a 100644 --- a/crates/ruff_linter/src/rules/flake8_pyi/rules/simple_defaults.rs +++ b/crates/ruff_linter/src/rules/flake8_pyi/rules/simple_defaults.rs @@ -145,7 +145,7 @@ impl AlwaysFixableViolation for AssignmentDefaultInStub { } } -/// ## What it does? +/// ## What it does /// Checks for unannotated assignments in stub (`.pyi`) files. /// /// ## Why is this bad? From 001c63a13c8324238a945b98dd1c6d1e3806c12f Mon Sep 17 00:00:00 2001 From: Muspi Merol Date: Tue, 25 Feb 2025 16:18:32 +0800 Subject: [PATCH 3/3] Remove leading `##` from `Use instead:` --- .../ruff_linter/src/rules/flake8_bandit/rules/django_extra.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/ruff_linter/src/rules/flake8_bandit/rules/django_extra.rs b/crates/ruff_linter/src/rules/flake8_bandit/rules/django_extra.rs index b3c9266b60260..b1e033a38b365 100644 --- a/crates/ruff_linter/src/rules/flake8_bandit/rules/django_extra.rs +++ b/crates/ruff_linter/src/rules/flake8_bandit/rules/django_extra.rs @@ -22,7 +22,7 @@ use crate::checkers::ast::Checker; /// User.objects.all().extra(select={"test": "%secure" % "nos"}) /// ``` /// -/// ## Use instead: +/// Use instead: /// ```python /// from django.contrib.auth.models import User ///