buildtools icon indicating copy to clipboard operation
buildtools copied to clipboard

build.Format should position a package() after load()s and before other rules

Open dnathe4th opened this issue 2 years ago • 0 comments

The current Rewriter implementation does not have any logic to ensure the order of a BUILD.bazel file that contains a package() rule is correct. According to the documentation for the package function a BUILD.bazel file should be ordered as:

  1. All load()s, to the extent that any exists
  2. A single package(), if one exists
  3. All rules

An additional rewrite rule could enforce this.

dnathe4th avatar Feb 22 '23 21:02 dnathe4th