Comments (7)
A tool like Chromium's gn format
or Closure's fixjsstyle
that can automatically clean up BUILD
and *.bzl
files would be nice along with this. e.g. find -name BUILD -exec gn format {} \;
.
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.
from bazel.
I'm not sure that this is an issue anymore, given that a BUILD file formatter apparently exists.
from bazel.
Are there any differences between build file formatting and .bzl files?
from bazel.
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.
from bazel.
Ah, I'm probably mistaken, as there seem to be different style guides for BUILD and .bzl files, which implies to me that there's a difference that is not too obvious.
from bazel.
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.
Buildifier cannot format .bzl files yet (it will skip function definitions).
from bazel.
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
https://github.com/bazelbuild/buildtools
from bazel.
Related Issues (20)
- build_tar attempts to use python2 when upgrading to Bazel 6.0.0 HOT 4
- Get I/O exception during sandboxed execution (File exists) when running bazel test. HOT 1
- Java: Overriding record toString() can't be referred to as a dependency HOT 1
- Failed to start local Bazel server on amd64 linux environment on apple silicon.
- [Build Failure] Bazel fails to find toolchains for java on FreeBSD 14-CURRENT amd64 from git checkout at HEAD While resolving toolchains for target @rules_jvm_external//private/tools/java/rules/jvm/external/jar:AddJarManifestEntry: No matching toolchains found for types @bazel_tools//tools/jdk:runtime_toolchain_type.
- 'cannot prefetch a directory' crash HOT 2
- `--remote-download-minimal` does not behave correctly with RBE and `bazel test`. HOT 2
- bazel fails to build target on Windows 11 RAM disk mount with blaze_util::MakeCanonical(...) failed: (error: 1): Incorrect function.
- Build event protocol has incomplete output names
- [bazel.coverage] Problem with coverage reports in multiple modes(set, atomic)
- [bazel.build] Problem with /start/cpp HOT 1
- [6.1.0] have 'bazel test' non-test targets depend on --remote_download_output
- [bazel.build] Problem with /reference/be/python
- 'Output null download failed' at HEAD HOT 2
- [6.1.0] Do the AC integrity check for disk part of the combined cache.
- [6.1.0] Rollback #14510 because it causes remote test execution to fail
- Release 6.1.0 - March 2023
- bazel-1.0.0: Depends: python but it is not installable
- Aspects with `required_providers` set do not run on attributes with `providers` set
- Resizing the terminal kills `bazel run` tests
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bazel.