mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 10:48:32 +00:00
[pyflakes] Update docs to describe WAI behavior (F541) (#11362)
Addresses this comment:
https://github.com/astral-sh/ruff/issues/11357#issuecomment-2104714029
## Summary
The docs for F541 did not mention some surprising, but WAI, behavior
regarding implicit string concatenation. Update the docs to describe the
behavior.
Here's how things rendered for me locally:

This commit is contained in:
parent
f79c980e17
commit
0726e82342
2 changed files with 23 additions and 0 deletions
|
@ -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]
|
||||
|
|
|
@ -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",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue