Skip to content

Commit

Permalink
Update f-string description
Browse files Browse the repository at this point in the history
  • Loading branch information
drdavella committed Dec 11, 2023
1 parent 7b16529 commit cdf3d2b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
This codemod converts any f-strings without interpolation to regular strings.
This codemod converts any f-strings without interpolated variables into regular strings.
In these cases the use of f-string is not necessary; a simple string literal is sufficient.

While in some (extreme) cases we might expect a very modest performance
improvement, in general this is a fix that improves the overall cleanliness and
quality of your code.

```diff
- var = f"hello"
Expand Down
6 changes: 5 additions & 1 deletion src/core_codemods/remove_unnecessary_f_str.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,14 @@ class RemoveUnnecessaryFStr(BaseCodemod, UnnecessaryFormatString):
SUMMARY = "Remove Unnecessary F-strings"
DESCRIPTION = UnnecessaryFormatString.DESCRIPTION
REFERENCES = [
{
"url": "https://pylint.readthedocs.io/en/latest/user_guide/messages/warning/f-string-without-interpolation.html",
"description": "",
},
{
"url": "https://github.com/Instagram/LibCST/blob/main/libcst/codemod/commands/unnecessary_format_string.py",
"description": "",
}
},
]

def __init__(self, codemod_context: CodemodContext, *codemod_args):
Expand Down

0 comments on commit cdf3d2b

Please sign in to comment.