@@ -175,7 +175,7 @@ Karma is run against the new output.
175175much easier to debug. ` xit ` and ` xdescribe ` can also be useful to exclude a test and a group of
176176tests respectively.
177177
178- ### E2e tests
178+ ### E2E tests
179179
1801801 . ` $(npm bin)/gulp build.js.cjs ` (builds benchpress and tests into ` dist/js/cjs ` folder).
1811812 . ` $(npm bin)/gulp serve.js.prod serve.js.dart2js ` (runs a local webserver).
@@ -195,30 +195,36 @@ Angular specific command line options when running protractor:
195195Angular specific command line options when running protractor (e.g. force gc, ...):
196196` $(npm bin)/protractor protractor-{js|dart2js}-conf.js --ng-help `
197197
198- ## Formatting
198+ ## Formatting with < a name = " clang-format " >clang-format</ a >
199199
200- We use [ clang-format] ( http://clang.llvm.org/docs/ClangFormat.html ) to automatically enforce code style for our TypeScript code.
201- This allows us to focus our code reviews more on the content, and less on style nit-picking.
202- It also lets us encode our style guide in the ` .clang-format ` file in the repository,
203- allowing many tools and editors to share our settings.
200+ We use [ clang-format] ( http://clang.llvm.org/docs/ClangFormat.html ) to automatically enforce code
201+ style for our TypeScript code. This allows us to focus our code reviews more on the content, and
202+ less on style nit-picking. It also lets us encode our style guide in the ` .clang-format ` file in the
203+ repository, allowing many tools and editors to share our settings.
204204
205205To check the formatting of your code, run
206206
207207 gulp check-format
208208
209- Note that the continuous build on Travis runs ` gulp enforce-format ` .
210- Unlike the ` check-format ` task, this will actually fail the build if files aren't formatted according to the style guide.
211-
212- Your life will be easier if you include the formatter in your standard workflow.
213- Otherwise, you'll likely forget to check the formatting,
214- and waste time waiting for a build on Travis that fails due to some whitespace difference.
215-
216- * ** git pre-commit hook** is available at
217- [ llvm.org] ( https://llvm.org/svn/llvm-project/cfe/trunk/tools/clang-format/git-clang-format ) .
218- This will automatically format your delta regions when you commit a change.
219- To install, first patch this file to add ` .ts ` to the ` default_extensions ` section.
220- Then copy the file somewhere in your path, for example, ` /usr/local/git/current/bin/git-clang-format ` .
221- Make sure it is executable. Then, in the angular repo, run
209+ Note that the continuous build on Travis runs ` gulp enforce-format ` . Unlike the ` check-format ` task,
210+ this will actually fail the build if files aren't formatted according to the style guide.
211+
212+ Your life will be easier if you include the formatter in your standard workflow. Otherwise, you'll
213+ likely forget to check the formatting, and waste time waiting for a build on Travis that fails due
214+ to some whitespace difference.
215+
216+ * Install clang-format with ` npm install -g clang-format ` .
217+ * Use ` clang-format -i [file name] ` to format a file (or multiple).
218+ Note that ` clang-format ` tries to load a ` clang-format ` node module close to the sources being
219+ formatted, or from the ` $CWD ` , and only then uses the globally installed one - so the version used
220+ should automatically match the one required by the project.
221+ Use ` clang-format -version ` in case you get confused.
222+ * Use ` gulp enforce-format ` to check if your code is ` clang-format ` clean. This also gives
223+ you a command line to format your code.
224+ * ` clang-format ` also includes a git hook, run ` git clang-format ` to format all files you
225+ touched.
226+ * You can run this as a ** git pre-commit hook** to automatically format your delta regions when you
227+ commit a change. In the angular repo, run
222228
223229```
224230 $ echo -e '#!/bin/sh\nexec git clang-format' > .git/hooks/pre-commit
@@ -237,7 +243,9 @@ Make sure it is executable. Then, in the angular repo, run
237243 - Program: [ path to clang-format, try ` $ echo $(npm config get prefix)/bin/clang-format ` ]
238244 - Parameters: ` -i -style=file $FilePath$ `
239245 - Working directory: ` $ProjectFileDir$ `
240-
246+ * ` clang-format ` integrations are also available for many popular editors (` vim ` , ` emacs ` ,
247+ ` Sublime Text ` , etc.).
248+
241249## Project Information
242250
243251### Folder structure
0 commit comments