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

Buildifier does not support f-strings #1278

Open
cbarrete opened this issue Jul 12, 2024 · 2 comments
Open

Buildifier does not support f-strings #1278

cbarrete opened this issue Jul 12, 2024 · 2 comments

Comments

@cbarrete
Copy link

Buck2 supports f-string (although Bazel does not, at least yet), so it would be nice if buildifier did not consider them invalid syntax.

Currently, running it over:

name = "Cédric"
print(f"Hello, {name}!")

gives

> buildifier asdf.bzl
asdf.bzl:2:24: syntax error near "Hello, {name}!"
asdf.bzl # reformat

It seems like this could be implemented quite easily similarly to raw strings, is this correct?

@vladmos
Copy link
Member

vladmos commented Jul 17, 2024

That's correct, however the linter check for unused variables also need to be updated (e.g. the following code shoudln't issue warnings):

def f():
    foo = 'bar'
    return f'{foo}'

@aryandutt
Copy link

It looks like a good first issue, can I work on it?

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

3 participants