Skip to content

Ignore string literals in f-strings #3548#3551

Merged
sobolevn merged 3 commits intowemake-services:masterfrom
F0RRZZ:ignore-fstrings-in-wps226
Oct 21, 2025
Merged

Ignore string literals in f-strings #3548#3551
sobolevn merged 3 commits intowemake-services:masterfrom
F0RRZZ:ignore-fstrings-in-wps226

Conversation

@F0RRZZ
Copy link
Copy Markdown
Contributor

@F0RRZZ F0RRZZ commented Oct 18, 2025

@codecov
Copy link
Copy Markdown

codecov Bot commented Oct 18, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (349af6d) to head (0d6ed40).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #3551   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          369       369           
  Lines        12252     12263   +11     
  Branches       843       844    +1     
=========================================
+ Hits         12252     12263   +11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@pytest.mark.parametrize(
'strings',
[
"""
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, move all examples to a module level.

message = f'Hello, {world}'
""",
"""
first = f'test {value}'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These examples are all the same. Better let's place the patterns in different places.

For example:

  1. "Hello, {pattern}"
  2. "{pattern}-postfix"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two examples will be fine

Comment on lines +84 to +85
parent = walk.get_closest_parent(node, parents=(ast.JoinedStr,))
if isinstance(parent, ast.JoinedStr):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
parent = walk.get_closest_parent(node, parents=(ast.JoinedStr,))
if isinstance(parent, ast.JoinedStr):
# Part of the f-string:
if walk.get_closest_parent(node, parents=(ast.JoinedStr,)):

Copy link
Copy Markdown
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! One more thing: please, update CHANGELOG.md

@F0RRZZ
Copy link
Copy Markdown
Contributor Author

F0RRZZ commented Oct 21, 2025

@sobolevn Done!

Copy link
Copy Markdown
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@sobolevn sobolevn merged commit 09da60c into wemake-services:master Oct 21, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants