Skip to content

Conversation

@LarsMichelsen
Copy link
Contributor

When editing a file named BUILD, the command buildifier was executed, but the file in the editor was not reformatted properly.

If I'd run buildifier [path-to-file], the file would be reformatted as expected, so the formatter works as expected in this case.

After experimenting a bit, I came up with the new command line I propose in this change. It still sends the code via stdin to buildifier, but now is aware of the path the file has in the project. This seems to have an influence on the behavior of buildifier.

See buildifier --help:

  -type string
        Input file type: build (for BUILD files), bzl (for .bzl files),
        workspace (for WORKSPACE files), default (for generic Starlark
        files) or auto (default, based on the filename) (default "auto")

@github-actions github-actions bot requested a review from stevearc December 7, 2024 17:35
When editing a file named BUILD, the command `buildifier` was executed,
but the file in the editor was not reformatted properly.

If I'd run `buildifier [path-to-file]`, the file would be reformatted as
expected, so the formatter works as expected in this case.

After experimenting a bit, I came up with the new command line I propose
in this change. It still sends the code via stdin to `buildifier`, but
now is aware of the path the file has in the project. This seems to have
an influence on the behavior of `buildifier`.

See `buildifier --help`:

```
  -type string
        Input file type: build (for BUILD files), bzl (for .bzl files),
        workspace (for WORKSPACE files), default (for generic Starlark
        files) or auto (default, based on the filename) (default "auto")
```
@stevearc
Copy link
Owner

stevearc commented Dec 8, 2024

LGTM thanks!

@stevearc stevearc merged commit e76afe8 into stevearc:master Dec 8, 2024
7 checks passed
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 this pull request may close these issues.

2 participants