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
Buildozer now reorders load statements for all file types except for WORKSPACE files. The problem here is that buildozer doesn't know that the file is called WORKSPACE because it's been passed via stdin.
I think the correct way of fixing it is to disable moving load statements on top if the filename is not known (or if it's a random temp file name that's neither BUILD- nor WORKSPACE-like). A downside would be that if you pass a BUILD file with load statements placed randomly in the file, buildozer won't make it complying the formatting rules, but that should be 1) a rare case, and 2) smaller problem than making a file incorrect and breaking builds.
I think we should provide a way to do step 2 without using stdin. This will be more convenient for the users, and it will give much more information to Buildifier (e.g. know the path).
In general, load statements can be moved (according to the Starlark spec), workspace files are just a weird corner case.
Steps to reproduce:
WORKSPACE
. I think any file with multiple load statements will do, but this is the one I used to repro:cat WORKSPACE | buildozer 'set name rules_python' '-:rules_python'
This is a regression from
buildozer
7.0.0 onwards.buildozer
6.4.0 doesn't exhibit this behaviour.The text was updated successfully, but these errors were encountered: