Coder Social home page Coder Social logo

Skylark style guide about bazel HOT 7 CLOSED

google avatar google commented on June 15, 2024
Skylark style guide

from bazel.

Comments (7)

kjiwa avatar kjiwa commented on June 15, 2024

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.

jbduncan avatar jbduncan commented on June 15, 2024

I'm not sure that this is an issue anymore, given that a BUILD file formatter apparently exists.

from bazel.

softprops avatar softprops commented on June 15, 2024

Are there any differences between build file formatting and .bzl files?

from bazel.

jbduncan avatar jbduncan commented on June 15, 2024

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.

jbduncan avatar jbduncan commented on June 15, 2024

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.

laurentlb avatar laurentlb commented on June 15, 2024

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.

laurentlb avatar laurentlb commented on June 15, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.