-
Notifications
You must be signed in to change notification settings - Fork 421
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
WORKSPACE load statements are reordered when reading from stdin #1268
Comments
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 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. |
|
for my very specific nvim conform case i fixed this by
|
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: