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 removes some comments #68

Closed
pmbethe09 opened this issue Mar 22, 2017 · 3 comments · Fixed by #102
Closed

Buildifier removes some comments #68

pmbethe09 opened this issue Mar 22, 2017 · 3 comments · Fixed by #102

Comments

@pmbethe09
Copy link
Member

[ # This line will be eaten by buildifier
# but not this line.
cc_binary(
name = "something_%s_useful" % lang,
)
for lang in li]

@gcc42
Copy link
Contributor

gcc42 commented Mar 22, 2017

I'm working on this right now. Actually slight correction, there needs to be an input like

[a for b in c
]

[ #comment on the first line of a container with the opening [ or ( or { will be eaten
]

for the bug to materialize

gcc42 added a commit to gcc42/buildifier that referenced this issue Mar 22, 2017
@vladmos
Copy link
Member

vladmos commented May 31, 2017

Currently buildifier doesn't allow to make comment on a multiline list, for example:

items = [
    a,
    b,
]  # a list of items

also it doesn't allow commenting on a function call:

foo(
  x,
  y,
)  # bar

I'm working on this issue and I'd like to remove these restrictions as they seem to be related to the initial problem. Are there any objections / reasons why buildifier is implemented this way?

@vladmos
Copy link
Member

vladmos commented Jun 2, 2017

Another example of a missing comment:

[
  x
  for x in y #foo
  if x # bar
]

is formatted to

[
  x
  for x in y
  if x
]

due to a bug in the printer.

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 a pull request may close this issue.

3 participants