Skip to content

Commit

Permalink
[pyflakes] Update docs to describe WAI behavior (F541) (#11362)
Browse files Browse the repository at this point in the history
Addresses this comment:
#11357 (comment)


## 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:


![image](https://github.com/astral-sh/ruff/assets/5386897/32067121-b190-4268-b987-ff37df11a618)
  • Loading branch information
dougthor42 committed May 10, 2024
1 parent f79c980 commit 0726e82
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
Expand Up @@ -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]
Expand Down
1 change: 1 addition & 0 deletions scripts/check_docs_formatted.py
Expand Up @@ -39,6 +39,7 @@
"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",
Expand Down

0 comments on commit 0726e82

Please sign in to comment.