From a057789235c6fb8125516460f038ae2ce727141c Mon Sep 17 00:00:00 2001 From: Martin Probst Date: Fri, 19 Jun 2015 16:30:03 -0700 Subject: [PATCH] docs: clang-format instructions in CONTRIBUTING.md Document installation, command line usage, editors, etc. --- CONTRIBUTING.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3648339fa3..330896cf9b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -139,6 +139,19 @@ To ensure consistency throughout the source code, keep these rules in mind as yo [Google's JavaScript Style Guide][js-style-guide]: * Wrap all code at **100 characters**. +### clang-format +The Angular project uses [`clang-format`](http://clang.llvm.org/docs/ClangFormat.html) to +automatically format its source and enforce the common coding style. A couple of tips: + +* Install clang-format with `npm install -g clang-format`. +* Use `clang-format -i [file name]` to format a file (or multiple). +* Use `gulp enforce-format` to check if your code is `clang-format` clean. This also gives + you a command line to format your code. +* `clang-format` also includes a git hook, run `git clang-format` to format all files you + touched. +* `clang-format` integrations are available for many popular editors (`vim`, `emacs`, + `Sublime Text`, etc.) + ## Commit Message Guidelines We have very precise rules over how our git commit messages can be formatted. This leads to **more