Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TMP101 detects f-strings as hardcoded #149

Open
silpheel opened this issue Sep 17, 2020 · 0 comments
Open

TMP101 detects f-strings as hardcoded #149

silpheel opened this issue Sep 17, 2020 · 0 comments

Comments

@silpheel
Copy link

TMP101 is flagged for the open() call when using f-strings.

Concatenating the same variable with the + operator is correctly detected, even though both versions are functionally identical.

  • Code sample 1 triggers TMP101:
    with open(f"/tmp/{name}.html", "w") as html_file:

  • Code sample 2 does not trigger TMP101:
    with open(f"/tmp/" + name + ".html", "w") as html_file:

I believe the code for this is in this area:

override fun visitPyCallExpression(node: PyCallExpression) {

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

No branches or pull requests

1 participant