Return non zero code, if check mode failed (#115)

Fixes: #110.

The point of check mode is to be able to verify the formatting of BUILD
files from the CI:

  $ buildifier -mode=check $(find . -name BUILD)

Choose the next free return value 4, and return it in case, reformat is
needed.
1 file changed
tree: 43af5d8f73a12a40138c18efe74a5479ff79bc56
  1. api_proto/
  2. build/
  3. build_proto/
  4. buildifier/
  5. buildozer/
  6. config/
  7. deps_proto/
  8. differ/
  9. edit/
  10. extra_actions_base_proto/
  11. file/
  12. generatetables/
  13. lang/
  14. tables/
  15. unused_deps/
  16. wspace/
  17. .gitignore
  18. BUILD.bazel
  19. CONTRIBUTING.md
  20. CONTRIBUTORS
  21. LICENSE
  22. README.md
  23. status.sh
  24. WORKSPACE
README.md

Buildifier

buildifier is a tool for formatting bazel BUILD files with a standard convention.

linux-x86_64ubuntu_15.10-x86_64darwin-x86_64
Build StatusBuild StatusBuild Status

Setup

Build the tool:

  • Checkout the repo and then either via go install or bazel build //buildifier
  • If you already have ‘go’ installed, then build a binary via:

go get github.com/bazelbuild/buildtools/buildifier

Usage

Use buildifier to create standardized formatting for BUILD files in the same way that clang-format is used for source files.

$ buildifier -showlog -mode=check $(find . -iname BUILD -type f)