GithubHelp home page GithubHelp logo

style-guard-demo's Introduction

What?

The intention here is to get source code formatting automatically checked and guaranteed before checkin.

Why?

  • Automate style-guide compliance to avoid squabbles
  • Post-checkin reformatting binges mess up history. It’s best to get it right from the get-go.

How?

See the tools:

  • tools/check-formatting --staged for fast style-checking of changed files, in a git commit/push hook;
  • tools/check-formatting --all for slower style-checking of everything
  • tools/format-all to format everything

To enable the checking as a pre-commit hook, place the following in .git/hooks/pre-commit (and make that file executable):

#!/bin/bash
./tools/check-formatting --staged

Tips

  • We should not reformat bundled third-party code as it will make it difficult to diff with upstream. Put such code in a subdirectory with its own .clangformat file containing: “BasedOnStyle: None” to disable formatting.
  • If clang-format mangles something (for example, a comment block with ASCII art or significant whitespace), you can protect a block using // clang-format off and then // clang-format on.

What are these binaries?

The `clang-format` binaries that are checked in are static builds of clang-format v3.9 from https://github.com/angular/clang-format. They are bundled because the LLVM toolchain has a reputation for rapid change and incompatibility. We want to guarantee that devs are using the same version as CI is.

style-guard-demo's People

Contributors

dalexander avatar

Watchers

 avatar  avatar

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.