diff --git a/crates/ruff_linter/src/rules/pyflakes/rules/f_string_missing_placeholders.rs b/crates/ruff_linter/src/rules/pyflakes/rules/f_string_missing_placeholders.rs index 36263f3328..122e78d63d 100644 --- a/crates/ruff_linter/src/rules/pyflakes/rules/f_string_missing_placeholders.rs +++ b/crates/ruff_linter/src/rules/pyflakes/rules/f_string_missing_placeholders.rs @@ -29,6 +29,28 @@ use crate::checkers::ast::Checker; /// "Hello, world!" /// ``` /// +/// **Note:** to maintain compatibility with PyFlakes, this rule only flags +/// f-strings that are part of an implicit concatenation if _none_ of the +/// f-string segments contain placeholder expressions. +/// +/// For example: +/// +/// ```python +/// # Will not be flagged. +/// ( +/// f"Hello," +/// f" {name}!" +/// ) +/// +/// # Will be flagged. +/// ( +/// f"Hello," +/// f" World!" +/// ) +/// ``` +/// +/// See [#10885](https://github.com/astral-sh/ruff/issues/10885) for more. +/// /// ## References /// - [PEP 498](https://www.python.org/dev/peps/pep-0498/) #[violation] diff --git a/scripts/check_docs_formatted.py b/scripts/check_docs_formatted.py index 96f6ec3a74..979aee658a 100755 --- a/scripts/check_docs_formatted.py +++ b/scripts/check_docs_formatted.py @@ -39,6 +39,7 @@ KNOWN_FORMATTING_VIOLATIONS = [ "blank-lines-before-nested-definition", "blank-lines-top-level", "explicit-string-concatenation", + "f-string-missing-placeholders", "indent-with-spaces", "indentation-with-invalid-multiple", "line-too-long",