Fix incorrect reference in `extend-immutable-calls` documentation (#5890)

This commit is contained in:
Charlie Marsh 2023-07-19 15:57:05 -04:00 committed by GitHub
parent e1d76b60cc
commit 598549d24e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 15 additions and 9 deletions

View File

@ -4112,7 +4112,7 @@ where
flake8_bugbear::rules::mutable_argument_default(self, arguments);
}
if self.enabled(Rule::FunctionCallInDefaultArgument) {
flake8_bugbear::rules::function_call_argument_default(self, arguments);
flake8_bugbear::rules::function_call_in_argument_default(self, arguments);
}
if self.settings.rules.enabled(Rule::ImplicitOptional) {
ruff::rules::implicit_optional(self, arguments);

View File

@ -103,7 +103,7 @@ where
}
/// B008
pub(crate) fn function_call_argument_default(checker: &mut Checker, arguments: &Arguments) {
pub(crate) fn function_call_in_argument_default(checker: &mut Checker, arguments: &Arguments) {
// Map immutable calls to (module, member) format.
let extend_immutable_calls: Vec<CallPath> = checker
.settings

View File

@ -8,7 +8,7 @@ pub(crate) use duplicate_value::*;
pub(crate) use except_with_empty_tuple::*;
pub(crate) use except_with_non_exception_classes::*;
pub(crate) use f_string_docstring::*;
pub(crate) use function_call_argument_default::*;
pub(crate) use function_call_in_argument_default::*;
pub(crate) use function_uses_loop_variable::*;
pub(crate) use getattr_with_constant::*;
pub(crate) use jump_statement_in_finally::*;
@ -42,7 +42,7 @@ mod duplicate_value;
mod except_with_empty_tuple;
mod except_with_non_exception_classes;
mod f_string_docstring;
mod function_call_argument_default;
mod function_call_in_argument_default;
mod function_uses_loop_variable;
mod getattr_with_constant;
mod jump_statement_in_finally;

View File

@ -22,9 +22,12 @@ pub struct Options {
extend-immutable-calls = ["fastapi.Depends", "fastapi.Query"]
"#
)]
/// Additional callable functions to consider "immutable" when evaluating,
/// e.g., the `no-mutable-default-argument` rule (`B006`) or
/// `no-function-call-in-dataclass-defaults` rule (`RUF009`).
/// Additional callable functions to consider "immutable" when evaluating, e.g., the
/// `function-call-in-default-argument` rule (`B008`) or `function-call-in-dataclass-defaults`
/// rule (`RUF009`).
///
/// Expects to receive a list of fully-qualified names (e.g., `fastapi.Query`, rather than
/// `Query`).
pub extend_immutable_calls: Option<Vec<String>>,
}

View File

@ -22,6 +22,9 @@ pub struct Options {
/// Additional functions or classes to consider generic, such that any
/// subscripts should be treated as type annotation (e.g., `ForeignKey` in
/// `django.db.models.ForeignKey["User"]`.
///
/// Expects to receive a list of fully-qualified names (e.g., `django.db.models.ForeignKey`,
/// rather than `ForeignKey`).
pub extend_generics: Option<Vec<String>>,
}

4
ruff.schema.json generated
View File

@ -720,7 +720,7 @@
"type": "object",
"properties": {
"extend-immutable-calls": {
"description": "Additional callable functions to consider \"immutable\" when evaluating, e.g., the `no-mutable-default-argument` rule (`B006`) or `no-function-call-in-dataclass-defaults` rule (`RUF009`).",
"description": "Additional callable functions to consider \"immutable\" when evaluating, e.g., the `function-call-in-default-argument` rule (`B008`) or `function-call-in-dataclass-defaults` rule (`RUF009`).\n\nExpects to receive a list of fully-qualified names (e.g., `fastapi.Query`, rather than `Query`).",
"type": [
"array",
"null"
@ -1515,7 +1515,7 @@
"type": "object",
"properties": {
"extend-generics": {
"description": "Additional functions or classes to consider generic, such that any subscripts should be treated as type annotation (e.g., `ForeignKey` in `django.db.models.ForeignKey[\"User\"]`.",
"description": "Additional functions or classes to consider generic, such that any subscripts should be treated as type annotation (e.g., `ForeignKey` in `django.db.models.ForeignKey[\"User\"]`.\n\nExpects to receive a list of fully-qualified names (e.g., `django.db.models.ForeignKey`, rather than `ForeignKey`).",
"type": [
"array",
"null"