You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adds *.bazel to the Starlark file patterns to format files like foo.bazel. Previously only specific files like BUILD.bazel, MODULE.bazel, and WORKSPACE.bazel were matched.
To avoid formatting generated lockfiles, this also introduces an exclusion mechanism that filters out *.lock.bazel files (e.g., multitool.lock.bazel).
Changes are visible to end-users: yes
Searched for relevant documentation and updated as needed: no
Breaking change (forces users to change their own code or config): no
Suggested release notes appear below: yes
Release notes: The Starlark formatter now includes *.bazel files. Lockfiles matching *.lock.bazel are excluded.
Test plan
Manual testing; please provide instructions so we can reproduce:
Create a foo.bazel file and a bar.lock.bazel file in your workspace
Run the format command targeting Starlark files
Verify foo.bazel is formatted and bar.lock.bazel is excluded
foo in this case is just a placeholder. A more concrete example would be where you can have more than one BUILD.bazel file in a folder. Say when using new_local_repository and supplying a BUILD.package.bazel file to for build_file, that does the building for that repository. As well as having a BUILD.bazel file in the same folder for packaging a target from that repository with your application. Separating the packaging logic (unique to your application) from the repositories building logic (specific to that repository).
foo in this case is just a placeholder. A more concrete example would be where you can have more than one BUILD.bazel file in a folder. Say when using new_local_repository and supplying a BUILD.package.bazel file to for build_file, that does the building for that repository. As well as having a BUILD.bazel file in the same folder for packaging a target from that repository with your application. Separating the packaging logic (unique to your application) from the repositories building logic (specific to that repository).
We also follow the convention of using BUILD.package.bazel for third-party repository overlays. Having these files be auto-formatted would be nice.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Include
*.bazelfiles in Starlark formattingAdds
*.bazelto the Starlark file patterns to format files likefoo.bazel. Previously only specific files likeBUILD.bazel,MODULE.bazel, andWORKSPACE.bazelwere matched.To avoid formatting generated lockfiles, this also introduces an exclusion mechanism that filters out
*.lock.bazelfiles (e.g.,multitool.lock.bazel).Changes are visible to end-users: yes
Release notes: The Starlark formatter now includes
*.bazelfiles. Lockfiles matching*.lock.bazelare excluded.Test plan
foo.bazelfile and abar.lock.bazelfile in your workspacefoo.bazelis formatted andbar.lock.bazelis excluded