mirror of
https://github.com/astral-sh/ruff
synced 2026-01-21 13:30:49 -05:00
Document options for more rules (#22295)
Summary -- This is a follow up to #22198 documenting more rule options I found while going through all of our rules. The second commit renames the internal `flake8_gettext::Settings::functions_names` field to `function_names` to match the external configuration option. I guess this is technically breaking because it's exposed to users via `--show-settings`, but I don't think we consider that part of our stable API. I can definitely revert that if needed, though. The other changes are just like #22198, adding new `## Options` sections to rules to document the settings they use. I missed these in the previous PR because they were used outside the rule implementations themselves. Most of these settings are checked where the rules' implementation functions are called instead. Oh, the last commit also updates the removal date for `typing.ByteString`, which got pushed back in the 3.14 release. I snuck that in today since I never opened this PR last week. I also fixed one reference link in RUF041. Test Plan -- Docs checks in CI
This commit is contained in:
@@ -125,7 +125,7 @@ linter.flake8_copyright.notice_rgx = (?i)Copyright\s+((?:\(C\)|©)\s+)?\d{4}((-|
|
||||
linter.flake8_copyright.author = none
|
||||
linter.flake8_copyright.min_file_size = 0
|
||||
linter.flake8_errmsg.max_string_length = 0
|
||||
linter.flake8_gettext.functions_names = [
|
||||
linter.flake8_gettext.function_names = [
|
||||
_,
|
||||
gettext,
|
||||
ngettext,
|
||||
|
||||
@@ -127,7 +127,7 @@ linter.flake8_copyright.notice_rgx = (?i)Copyright\s+((?:\(C\)|©)\s+)?\d{4}((-|
|
||||
linter.flake8_copyright.author = none
|
||||
linter.flake8_copyright.min_file_size = 0
|
||||
linter.flake8_errmsg.max_string_length = 0
|
||||
linter.flake8_gettext.functions_names = [
|
||||
linter.flake8_gettext.function_names = [
|
||||
_,
|
||||
gettext,
|
||||
ngettext,
|
||||
|
||||
@@ -129,7 +129,7 @@ linter.flake8_copyright.notice_rgx = (?i)Copyright\s+((?:\(C\)|©)\s+)?\d{4}((-|
|
||||
linter.flake8_copyright.author = none
|
||||
linter.flake8_copyright.min_file_size = 0
|
||||
linter.flake8_errmsg.max_string_length = 0
|
||||
linter.flake8_gettext.functions_names = [
|
||||
linter.flake8_gettext.function_names = [
|
||||
_,
|
||||
gettext,
|
||||
ngettext,
|
||||
|
||||
@@ -129,7 +129,7 @@ linter.flake8_copyright.notice_rgx = (?i)Copyright\s+((?:\(C\)|©)\s+)?\d{4}((-|
|
||||
linter.flake8_copyright.author = none
|
||||
linter.flake8_copyright.min_file_size = 0
|
||||
linter.flake8_errmsg.max_string_length = 0
|
||||
linter.flake8_gettext.functions_names = [
|
||||
linter.flake8_gettext.function_names = [
|
||||
_,
|
||||
gettext,
|
||||
ngettext,
|
||||
|
||||
@@ -126,7 +126,7 @@ linter.flake8_copyright.notice_rgx = (?i)Copyright\s+((?:\(C\)|©)\s+)?\d{4}((-|
|
||||
linter.flake8_copyright.author = none
|
||||
linter.flake8_copyright.min_file_size = 0
|
||||
linter.flake8_errmsg.max_string_length = 0
|
||||
linter.flake8_gettext.functions_names = [
|
||||
linter.flake8_gettext.function_names = [
|
||||
_,
|
||||
gettext,
|
||||
ngettext,
|
||||
|
||||
@@ -126,7 +126,7 @@ linter.flake8_copyright.notice_rgx = (?i)Copyright\s+((?:\(C\)|©)\s+)?\d{4}((-|
|
||||
linter.flake8_copyright.author = none
|
||||
linter.flake8_copyright.min_file_size = 0
|
||||
linter.flake8_errmsg.max_string_length = 0
|
||||
linter.flake8_gettext.functions_names = [
|
||||
linter.flake8_gettext.function_names = [
|
||||
_,
|
||||
gettext,
|
||||
ngettext,
|
||||
|
||||
@@ -125,7 +125,7 @@ linter.flake8_copyright.notice_rgx = (?i)Copyright\s+((?:\(C\)|©)\s+)?\d{4}((-|
|
||||
linter.flake8_copyright.author = none
|
||||
linter.flake8_copyright.min_file_size = 0
|
||||
linter.flake8_errmsg.max_string_length = 0
|
||||
linter.flake8_gettext.functions_names = [
|
||||
linter.flake8_gettext.function_names = [
|
||||
_,
|
||||
gettext,
|
||||
ngettext,
|
||||
|
||||
@@ -125,7 +125,7 @@ linter.flake8_copyright.notice_rgx = (?i)Copyright\s+((?:\(C\)|©)\s+)?\d{4}((-|
|
||||
linter.flake8_copyright.author = none
|
||||
linter.flake8_copyright.min_file_size = 0
|
||||
linter.flake8_errmsg.max_string_length = 0
|
||||
linter.flake8_gettext.functions_names = [
|
||||
linter.flake8_gettext.function_names = [
|
||||
_,
|
||||
gettext,
|
||||
ngettext,
|
||||
|
||||
@@ -125,7 +125,7 @@ linter.flake8_copyright.notice_rgx = (?i)Copyright\s+((?:\(C\)|©)\s+)?\d{4}((-|
|
||||
linter.flake8_copyright.author = none
|
||||
linter.flake8_copyright.min_file_size = 0
|
||||
linter.flake8_errmsg.max_string_length = 0
|
||||
linter.flake8_gettext.functions_names = [
|
||||
linter.flake8_gettext.function_names = [
|
||||
_,
|
||||
gettext,
|
||||
ngettext,
|
||||
|
||||
@@ -238,7 +238,7 @@ linter.flake8_copyright.notice_rgx = (?i)Copyright\s+((?:\(C\)|©)\s+)?\d{4}((-|
|
||||
linter.flake8_copyright.author = none
|
||||
linter.flake8_copyright.min_file_size = 0
|
||||
linter.flake8_errmsg.max_string_length = 0
|
||||
linter.flake8_gettext.functions_names = [
|
||||
linter.flake8_gettext.function_names = [
|
||||
_,
|
||||
gettext,
|
||||
ngettext,
|
||||
|
||||
@@ -1043,7 +1043,7 @@ pub(crate) fn expression(expr: &Expr, checker: &Checker) {
|
||||
]) && flake8_gettext::is_gettext_func_call(
|
||||
checker,
|
||||
func,
|
||||
&checker.settings().flake8_gettext.functions_names,
|
||||
&checker.settings().flake8_gettext.function_names,
|
||||
) {
|
||||
if checker.is_rule_enabled(Rule::FStringInGetTextFuncCall) {
|
||||
flake8_gettext::rules::f_string_in_gettext_func_call(checker, args);
|
||||
|
||||
@@ -38,6 +38,10 @@ use crate::checkers::ast::Checker;
|
||||
/// _("Hello, %s!") % name # Looks for "Hello, %s!".
|
||||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
///
|
||||
/// - `lint.flake8-gettext.function-names`
|
||||
///
|
||||
/// ## References
|
||||
/// - [Python documentation: `gettext` — Multilingual internationalization services](https://docs.python.org/3/library/gettext.html)
|
||||
#[derive(ViolationMetadata)]
|
||||
|
||||
@@ -38,6 +38,10 @@ use crate::checkers::ast::Checker;
|
||||
/// _("Hello, %s!") % name # Looks for "Hello, %s!".
|
||||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
///
|
||||
/// - `lint.flake8-gettext.function-names`
|
||||
///
|
||||
/// ## References
|
||||
/// - [Python documentation: `gettext` — Multilingual internationalization services](https://docs.python.org/3/library/gettext.html)
|
||||
#[derive(ViolationMetadata)]
|
||||
|
||||
@@ -37,6 +37,10 @@ use crate::checkers::ast::Checker;
|
||||
/// _("Hello, %s!") % name # Looks for "Hello, %s!".
|
||||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
///
|
||||
/// - `lint.flake8-gettext.function-names`
|
||||
///
|
||||
/// ## References
|
||||
/// - [Python documentation: `gettext` — Multilingual internationalization services](https://docs.python.org/3/library/gettext.html)
|
||||
#[derive(ViolationMetadata)]
|
||||
|
||||
@@ -5,7 +5,7 @@ use std::fmt::{Display, Formatter};
|
||||
|
||||
#[derive(Debug, Clone, CacheKey)]
|
||||
pub struct Settings {
|
||||
pub functions_names: Vec<Name>,
|
||||
pub function_names: Vec<Name>,
|
||||
}
|
||||
|
||||
pub fn default_func_names() -> Vec<Name> {
|
||||
@@ -19,7 +19,7 @@ pub fn default_func_names() -> Vec<Name> {
|
||||
impl Default for Settings {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
functions_names: default_func_names(),
|
||||
function_names: default_func_names(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -30,7 +30,7 @@ impl Display for Settings {
|
||||
formatter = f,
|
||||
namespace = "linter.flake8_gettext",
|
||||
fields = [
|
||||
self.functions_names | array
|
||||
self.function_names | array
|
||||
]
|
||||
}
|
||||
Ok(())
|
||||
|
||||
@@ -32,6 +32,13 @@ use crate::{Edit, Fix, FixAvailability, Violation};
|
||||
/// "dog"
|
||||
/// )
|
||||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
///
|
||||
/// Setting `lint.flake8-implicit-str-concat.allow-multiline = false` will disable this rule because
|
||||
/// it would leave no allowed way to write a multi-line string.
|
||||
///
|
||||
/// - `lint.flake8-implicit-str-concat.allow-multiline`
|
||||
#[derive(ViolationMetadata)]
|
||||
#[violation_metadata(stable_since = "v0.0.201")]
|
||||
pub(crate) struct ExplicitStringConcatenation;
|
||||
|
||||
@@ -11,7 +11,7 @@ use crate::{FixAvailability, Violation};
|
||||
///
|
||||
/// ## Why is this bad?
|
||||
/// `ByteString` has been deprecated since Python 3.9 and will be removed in
|
||||
/// Python 3.14. The Python documentation recommends using either
|
||||
/// Python 3.17. The Python documentation recommends using either
|
||||
/// `collections.abc.Buffer` (or the `typing_extensions` backport
|
||||
/// on Python <3.12) or a union like `bytes | bytearray | memoryview` instead.
|
||||
///
|
||||
|
||||
@@ -36,6 +36,10 @@ use crate::rules::pep8_naming::settings::IgnoreNames;
|
||||
/// - Instead of `example-module-name` or `example module name`, use `example_module_name`.
|
||||
/// - Instead of `ExampleModule`, use `example_module`.
|
||||
///
|
||||
/// ## Options
|
||||
///
|
||||
/// - `lint.pep8-naming.ignore-names`
|
||||
///
|
||||
/// [PEP 8]: https://peps.python.org/pep-0008/#package-and-module-names
|
||||
#[derive(ViolationMetadata)]
|
||||
#[violation_metadata(stable_since = "v0.0.248")]
|
||||
|
||||
@@ -58,6 +58,11 @@ use crate::rules::pydocstyle::settings::Convention;
|
||||
/// """
|
||||
/// return distance / time
|
||||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
///
|
||||
/// - `lint.pydoclint.ignore-one-line-docstrings`
|
||||
/// - `lint.pydocstyle.convention`
|
||||
#[derive(ViolationMetadata)]
|
||||
#[violation_metadata(preview_since = "0.14.1")]
|
||||
pub(crate) struct DocstringExtraneousParameter {
|
||||
@@ -113,6 +118,12 @@ impl Violation for DocstringExtraneousParameter {
|
||||
/// """
|
||||
/// return distance / time
|
||||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
///
|
||||
/// - `lint.pydoclint.ignore-one-line-docstrings`
|
||||
/// - `lint.pydocstyle.convention`
|
||||
/// - `lint.pydocstyle.property-decorators`
|
||||
#[derive(ViolationMetadata)]
|
||||
#[violation_metadata(preview_since = "0.5.6")]
|
||||
pub(crate) struct DocstringMissingReturns;
|
||||
@@ -165,6 +176,11 @@ impl Violation for DocstringMissingReturns {
|
||||
/// for _ in range(n):
|
||||
/// print("Hello!")
|
||||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
///
|
||||
/// - `lint.pydoclint.ignore-one-line-docstrings`
|
||||
/// - `lint.pydocstyle.convention`
|
||||
#[derive(ViolationMetadata)]
|
||||
#[violation_metadata(preview_since = "0.5.6")]
|
||||
pub(crate) struct DocstringExtraneousReturns;
|
||||
@@ -218,6 +234,11 @@ impl Violation for DocstringExtraneousReturns {
|
||||
/// for i in range(1, n + 1):
|
||||
/// yield i
|
||||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
///
|
||||
/// - `lint.pydoclint.ignore-one-line-docstrings`
|
||||
/// - `lint.pydocstyle.convention`
|
||||
#[derive(ViolationMetadata)]
|
||||
#[violation_metadata(preview_since = "0.5.7")]
|
||||
pub(crate) struct DocstringMissingYields;
|
||||
@@ -270,6 +291,11 @@ impl Violation for DocstringMissingYields {
|
||||
/// for _ in range(n):
|
||||
/// print("Hello!")
|
||||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
///
|
||||
/// - `lint.pydoclint.ignore-one-line-docstrings`
|
||||
/// - `lint.pydocstyle.convention`
|
||||
#[derive(ViolationMetadata)]
|
||||
#[violation_metadata(preview_since = "0.5.7")]
|
||||
pub(crate) struct DocstringExtraneousYields;
|
||||
@@ -342,6 +368,11 @@ impl Violation for DocstringExtraneousYields {
|
||||
/// except ZeroDivisionError as exc:
|
||||
/// raise FasterThanLightError from exc
|
||||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
///
|
||||
/// - `lint.pydoclint.ignore-one-line-docstrings`
|
||||
/// - `lint.pydocstyle.convention`
|
||||
#[derive(ViolationMetadata)]
|
||||
#[violation_metadata(preview_since = "0.5.5")]
|
||||
pub(crate) struct DocstringMissingException {
|
||||
@@ -410,6 +441,11 @@ impl Violation for DocstringMissingException {
|
||||
/// It may often be desirable to document *all* exceptions that a function
|
||||
/// could possibly raise, even those which are not explicitly raised using
|
||||
/// `raise` statements in the function body.
|
||||
///
|
||||
/// ## Options
|
||||
///
|
||||
/// - `lint.pydoclint.ignore-one-line-docstrings`
|
||||
/// - `lint.pydocstyle.convention`
|
||||
#[derive(ViolationMetadata)]
|
||||
#[violation_metadata(preview_since = "0.5.5")]
|
||||
pub(crate) struct DocstringExtraneousException {
|
||||
|
||||
@@ -38,6 +38,10 @@ use crate::{Edit, Fix, FixAvailability, Violation};
|
||||
/// foobar.__doc__ # "Docstring for foo\bar."
|
||||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
///
|
||||
/// - `lint.pydocstyle.ignore-decorators`
|
||||
///
|
||||
/// ## References
|
||||
/// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/)
|
||||
/// - [Python documentation: String and Bytes literals](https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals)
|
||||
|
||||
@@ -34,6 +34,10 @@ use crate::{Edit, Fix, FixAvailability, Violation};
|
||||
/// """
|
||||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
///
|
||||
/// - `lint.pydocstyle.ignore-decorators`
|
||||
///
|
||||
/// ## References
|
||||
/// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/)
|
||||
/// - [NumPy Style Guide](https://numpydoc.readthedocs.io/en/latest/format.html)
|
||||
|
||||
@@ -33,6 +33,10 @@ use crate::{Edit, Fix, FixAvailability, Violation};
|
||||
/// """Return the mean of the given values."""
|
||||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
///
|
||||
/// - `lint.pydocstyle.ignore-decorators`
|
||||
///
|
||||
/// ## References
|
||||
/// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/)
|
||||
/// - [NumPy Style Guide](https://numpydoc.readthedocs.io/en/latest/format.html)
|
||||
@@ -80,6 +84,10 @@ impl Violation for BlankLineBeforeFunction {
|
||||
/// return sum(values) / len(values)
|
||||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
///
|
||||
/// - `lint.pydocstyle.ignore-decorators`
|
||||
///
|
||||
/// ## References
|
||||
/// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/)
|
||||
/// - [NumPy Style Guide](https://numpydoc.readthedocs.io/en/latest/format.html)
|
||||
|
||||
@@ -25,6 +25,10 @@ use crate::{AlwaysFixableViolation, Edit, Fix};
|
||||
/// """Return the mean of the given values."""
|
||||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
///
|
||||
/// - `lint.pydocstyle.ignore-decorators`
|
||||
///
|
||||
/// ## References
|
||||
/// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/)
|
||||
/// - [NumPy Style Guide](https://numpydoc.readthedocs.io/en/latest/format.html)
|
||||
|
||||
@@ -63,6 +63,10 @@ use crate::docstrings::Docstring;
|
||||
/// factorial.__doc__ # "Return the factorial of n."
|
||||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
///
|
||||
/// - `lint.pydocstyle.ignore-decorators`
|
||||
///
|
||||
/// ## References
|
||||
/// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/)
|
||||
/// - [Python documentation: `typing.overload`](https://docs.python.org/3/library/typing.html#typing.overload)
|
||||
|
||||
@@ -44,6 +44,10 @@ use crate::{Edit, Fix};
|
||||
/// The rule is also incompatible with the [formatter] when using
|
||||
/// `format.indent-style="tab"`.
|
||||
///
|
||||
/// ## Options
|
||||
///
|
||||
/// - `lint.pydocstyle.ignore-decorators`
|
||||
///
|
||||
/// ## References
|
||||
/// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/)
|
||||
/// - [NumPy Style Guide](https://numpydoc.readthedocs.io/en/latest/format.html)
|
||||
@@ -93,6 +97,10 @@ impl Violation for DocstringTabIndentation {
|
||||
/// We recommend against using this rule alongside the [formatter]. The
|
||||
/// formatter enforces consistent indentation, making the rule redundant.
|
||||
///
|
||||
/// ## Options
|
||||
///
|
||||
/// - `lint.pydocstyle.ignore-decorators`
|
||||
///
|
||||
/// ## References
|
||||
/// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/)
|
||||
/// - [NumPy Style Guide](https://numpydoc.readthedocs.io/en/latest/format.html)
|
||||
@@ -146,6 +154,10 @@ impl AlwaysFixableViolation for UnderIndentation {
|
||||
/// We recommend against using this rule alongside the [formatter]. The
|
||||
/// formatter enforces consistent indentation, making the rule redundant.
|
||||
///
|
||||
/// ## Options
|
||||
///
|
||||
/// - `lint.pydocstyle.ignore-decorators`
|
||||
///
|
||||
/// ## References
|
||||
/// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/)
|
||||
/// - [NumPy Style Guide](https://numpydoc.readthedocs.io/en/latest/format.html)
|
||||
|
||||
@@ -37,6 +37,10 @@ use crate::{AlwaysFixableViolation, Edit, Fix};
|
||||
/// """
|
||||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
///
|
||||
/// - `lint.pydocstyle.ignore-decorators`
|
||||
///
|
||||
/// ## References
|
||||
/// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/)
|
||||
/// - [NumPy Style Guide](https://numpydoc.readthedocs.io/en/latest/format.html)
|
||||
|
||||
@@ -27,6 +27,10 @@ use crate::rules::pydocstyle::helpers::ends_with_backslash;
|
||||
/// """Return the factorial of n."""
|
||||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
///
|
||||
/// - `lint.pydocstyle.ignore-decorators`
|
||||
///
|
||||
/// ## References
|
||||
/// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/)
|
||||
/// - [NumPy Style Guide](https://numpydoc.readthedocs.io/en/latest/format.html)
|
||||
|
||||
@@ -24,6 +24,10 @@ use crate::docstrings::Docstring;
|
||||
/// """Return the mean of the given values."""
|
||||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
///
|
||||
/// - `lint.pydocstyle.ignore-decorators`
|
||||
///
|
||||
/// ## References
|
||||
/// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/)
|
||||
/// - [NumPy Style Guide](https://numpydoc.readthedocs.io/en/latest/format.html)
|
||||
|
||||
@@ -55,6 +55,10 @@ use crate::checkers::ast::Checker;
|
||||
/// ## Notebook behavior
|
||||
/// This rule is ignored for Jupyter Notebooks.
|
||||
///
|
||||
/// ## Options
|
||||
///
|
||||
/// - `lint.pydocstyle.ignore-decorators`
|
||||
///
|
||||
/// ## References
|
||||
/// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/)
|
||||
/// - [PEP 287 – reStructuredText Docstring Format](https://peps.python.org/pep-0287/)
|
||||
@@ -139,6 +143,10 @@ impl Violation for UndocumentedPublicModule {
|
||||
/// self.points += points
|
||||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
///
|
||||
/// - `lint.pydocstyle.ignore-decorators`
|
||||
///
|
||||
/// ## References
|
||||
/// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/)
|
||||
/// - [PEP 287 – reStructuredText Docstring Format](https://peps.python.org/pep-0287/)
|
||||
@@ -366,6 +374,10 @@ impl Violation for UndocumentedPublicFunction {
|
||||
/// __all__ = ["player", "game"]
|
||||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
///
|
||||
/// - `lint.pydocstyle.ignore-decorators`
|
||||
///
|
||||
/// ## References
|
||||
/// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/)
|
||||
/// - [PEP 287 – reStructuredText Docstring Format](https://peps.python.org/pep-0287/)
|
||||
@@ -480,6 +492,10 @@ impl Violation for UndocumentedMagicMethod {
|
||||
/// bar.__doc__ # "Class Bar."
|
||||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
///
|
||||
/// - `lint.pydocstyle.ignore-decorators`
|
||||
///
|
||||
/// ## References
|
||||
/// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/)
|
||||
/// - [PEP 287 – reStructuredText Docstring Format](https://peps.python.org/pep-0287/)
|
||||
|
||||
@@ -32,6 +32,10 @@ use crate::{Edit, Fix, FixAvailability, Violation};
|
||||
/// documentation generators, or custom introspection utilities that rely on
|
||||
/// specific docstring formatting.
|
||||
///
|
||||
/// ## Options
|
||||
///
|
||||
/// - `lint.pydocstyle.ignore-decorators`
|
||||
///
|
||||
/// ## References
|
||||
/// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/)
|
||||
///
|
||||
|
||||
@@ -1066,6 +1066,10 @@ impl AlwaysFixableViolation for MissingBlankLineAfterLastSection {
|
||||
/// raise FasterThanLightError from exc
|
||||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
///
|
||||
/// - `lint.pydocstyle.ignore-decorators`
|
||||
///
|
||||
/// ## References
|
||||
/// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/)
|
||||
/// - [PEP 287 – reStructuredText Docstring Format](https://peps.python.org/pep-0287/)
|
||||
@@ -1317,6 +1321,10 @@ impl Violation for UndocumentedParam {
|
||||
/// raise FasterThanLightError from exc
|
||||
/// ```
|
||||
///
|
||||
/// ## Options
|
||||
///
|
||||
/// - `lint.pydocstyle.ignore-decorators`
|
||||
///
|
||||
/// ## References
|
||||
/// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/)
|
||||
/// - [PEP 287 – reStructuredText Docstring Format](https://peps.python.org/pep-0287/)
|
||||
|
||||
@@ -31,6 +31,10 @@ use crate::{Edit, Fix, FixAvailability, Violation};
|
||||
/// We recommend against using this rule alongside the [formatter]. The
|
||||
/// formatter enforces consistent quotes, making the rule redundant.
|
||||
///
|
||||
/// ## Options
|
||||
///
|
||||
/// - `lint.pydocstyle.ignore-decorators`
|
||||
///
|
||||
/// ## References
|
||||
/// - [PEP 257 – Docstring Conventions](https://peps.python.org/pep-0257/)
|
||||
/// - [NumPy Style Guide](https://numpydoc.readthedocs.io/en/latest/format.html)
|
||||
|
||||
@@ -34,6 +34,10 @@ use crate::{Edit, Fix, FixAvailability, Violation};
|
||||
/// different values when introspecting types at runtime. However, in most cases,
|
||||
/// the fix should be safe to apply.
|
||||
///
|
||||
/// ## Options
|
||||
///
|
||||
/// - `target-version`
|
||||
///
|
||||
/// [PEP 646]: https://peps.python.org/pep-0646/
|
||||
#[derive(ViolationMetadata)]
|
||||
#[violation_metadata(stable_since = "0.10.0")]
|
||||
|
||||
@@ -78,6 +78,10 @@ use super::{
|
||||
/// This rule only applies to generic classes and does not include generic functions. See
|
||||
/// [`non-pep695-generic-function`][UP047] for the function version.
|
||||
///
|
||||
/// ## Options
|
||||
///
|
||||
/// - `target-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/
|
||||
|
||||
@@ -71,6 +71,10 @@ use super::{DisplayTypeVars, TypeVarReferenceVisitor, check_type_vars, in_nested
|
||||
/// This rule only applies to generic functions and does not include generic classes. See
|
||||
/// [`non-pep695-generic-class`][UP046] for the class version.
|
||||
///
|
||||
/// ## Options
|
||||
///
|
||||
/// - `target-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/
|
||||
|
||||
@@ -78,6 +78,10 @@ use super::{
|
||||
/// new type parameters are restricted in scope to their associated aliases. See
|
||||
/// [`private-type-parameter`][UP049] for a rule to update these names.
|
||||
///
|
||||
/// ## Options
|
||||
///
|
||||
/// - `target-version`
|
||||
///
|
||||
/// [PEP 695]: https://peps.python.org/pep-0695/
|
||||
/// [PYI018]: https://docs.astral.sh/ruff/rules/unused-private-type-var/
|
||||
/// [UP046]: https://docs.astral.sh/ruff/rules/non-pep695-generic-class/
|
||||
|
||||
@@ -72,6 +72,10 @@ use crate::{Edit, Fix, FixAvailability, Violation};
|
||||
/// As such, migrating to `enum.StrEnum` will introduce a behavior change for
|
||||
/// code that relies on the Python 3.11 behavior.
|
||||
///
|
||||
/// ## Options
|
||||
///
|
||||
/// - `target-version`
|
||||
///
|
||||
/// ## References
|
||||
/// - [enum.StrEnum](https://docs.python.org/3/library/enum.html#enum.StrEnum)
|
||||
///
|
||||
|
||||
@@ -57,7 +57,7 @@ use crate::{Applicability, Edit, Fix, FixAvailability, Violation};
|
||||
/// ## References
|
||||
/// - [Typing documentation: Legal parameters for `Literal` at type check time](https://typing.python.org/en/latest/spec/literal.html#legal-parameters-for-literal-at-type-check-time)
|
||||
///
|
||||
/// [PEP 586](https://peps.python.org/pep-0586/)
|
||||
/// [PEP 586]: https://peps.python.org/pep-0586/
|
||||
#[derive(ViolationMetadata)]
|
||||
#[violation_metadata(stable_since = "0.10.0")]
|
||||
pub(crate) struct UnnecessaryNestedLiteral;
|
||||
|
||||
@@ -1479,7 +1479,7 @@ pub struct Flake8GetTextOptions {
|
||||
impl Flake8GetTextOptions {
|
||||
pub fn into_settings(self) -> flake8_gettext::settings::Settings {
|
||||
flake8_gettext::settings::Settings {
|
||||
functions_names: self
|
||||
function_names: self
|
||||
.function_names
|
||||
.unwrap_or_else(flake8_gettext::settings::default_func_names)
|
||||
.into_iter()
|
||||
|
||||
Reference in New Issue
Block a user