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 fix has surprising behavior when an unused load statement is found on the top of the file #1328

Open
yashhshah opened this issue Jan 29, 2025 · 1 comment

Comments

@yashhshah
Copy link

yashhshah commented Jan 29, 2025

buildifier version: 7.3.1

Description

Buildifier is incorrectly removing comments from the top of the build file while trying to fix an unused load statement at the top of the file.

An example BUILD file would have something like:

# some comment
load("//:target.bzl", "unused")

When removing the unused load statement, buildifier also removes the comment above it.

@laurentlb
Copy link
Contributor

The recommendation is to put an empty line between the comment and the load statement.

Without separating line, the comment is "attached" to the next statement. Buildifier assumes the comment is for the load itself.

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

2 participants