-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Skylark style guide #63
Comments
A tool like Chromium's See https://code.google.com/p/chromium/codesearch#chromium/src/tools/gn/command_format.cc as an example of a tool that uses a BUILD-like syntax. |
I'm not sure that this is an issue anymore, given that a BUILD file formatter apparently exists. |
Are there any differences between build file formatting and .bzl files? |
Good question. I'm new to Bazel, so I didn't realise that there was a difference between the two. From my current understanding, both BUILD and .bzl files follow the Skylark syntax, so I'd be a little surprised if the BUILD file formatter couldn't format .bzl files as well. |
Style guide and formatter are different things. You don't put the same things in BUILD files and in bzl files, so it's better to have separate style guides. |
Closing this issue. We have now much more information in the documentation (see Best practices) and a code formatter. https://docs.bazel.build/versions/master/skylark/bzl-style.html |
The signature of Args.add seems to have changed, now expecting a positional argument. See: https://docs.bazel.build/versions/master/skylark/lib/Args.html
While Skylark is a Python subset, there are slight differences between Skylark/BUILD style vs. the Google Python conventions. For example (from the Skylark cookbook:
Rule invocations such as
native.genrule()
follow the BUILD style rather than the standard Python function call style.I think it would be good to write a Skylark Style Guide that defines a convention for Skylark code and lists some best practices.
The text was updated successfully, but these errors were encountered: