|
2 | 2 |
|
3 | 3 | ## Table of Contents
|
4 | 4 |
|
| 5 | +* [Guides and References](#guides-and-references) |
5 | 6 | * [Formatting](#formatting)
|
6 | 7 | * [Left-leaning (C++ style) asterisks for pointer declarations](#left-leaning-c-style-asterisks-for-pointer-declarations)
|
7 | 8 | * [C++ style comments](#c-style-comments)
|
|
25 | 26 | * [Avoid throwing JavaScript errors in C++ methods](#avoid-throwing-javascript-errors-in-c)
|
26 | 27 | * [Avoid throwing JavaScript errors in nested C++ methods](#avoid-throwing-javascript-errors-in-nested-c-methods)
|
27 | 28 |
|
28 |
| -Unfortunately, the C++ linter (based on |
29 |
| -[Google’s `cpplint`](https://github.com/google/styleguide)), which can be run |
30 |
| -explicitly via `make lint-cpp`, does not currently catch a lot of rules that are |
31 |
| -specific to the Node.js C++ code base. This document explains the most common of |
32 |
| -these rules: |
| 29 | + |
| 30 | +## Guides and References |
| 31 | + |
| 32 | +The Node.js C++ codebase strives to be consistent in its use of language |
| 33 | +features and idioms, as well as have some specific guidelines for the use of |
| 34 | +runtime features. |
| 35 | + |
| 36 | +Coding guidelines are based on the following guides (highest priority first): |
| 37 | +1. This document |
| 38 | +2. The [Google C++ Style Guide][] |
| 39 | +3. The ISO [C++ Core Guidelines][] |
| 40 | + |
| 41 | +In general code should follow the C++ Core Guidelines, unless overridden by the |
| 42 | +Google C++ Style Guide or this document. At the moment these guidelines are |
| 43 | +checked manually by reviewers, with the goal to validate this with automatic |
| 44 | +tools. |
33 | 45 |
|
34 | 46 | ## Formatting
|
35 | 47 |
|
| 48 | +Unfortunately, the C++ linter (based on [Google’s `cpplint`][]), which can be |
| 49 | +run explicitly via `make lint-cpp`, does not currently catch a lot of rules that |
| 50 | +are specific to the Node.js C++ code base. This document explains the most |
| 51 | +common of these rules: |
| 52 | + |
36 | 53 | ### Left-leaning (C++ style) asterisks for pointer declarations
|
37 | 54 |
|
38 | 55 | `char* buffer;` instead of `char *buffer;`
|
@@ -304,4 +321,8 @@ not inside of nested calls.
|
304 | 321 |
|
305 | 322 | Using C++ `throw` is not allowed.
|
306 | 323 |
|
| 324 | + |
| 325 | +[C++ Core Guidelines]: http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines |
| 326 | +[Google C++ Style Guide]: https://google.github.io/styleguide/cppguide.html |
| 327 | +[Google’s `cpplint`]: https://github.com/google/styleguide |
307 | 328 | [errors]: https://github.com/nodejs/node/blob/master/doc/guides/using-internal-errors.md
|
0 commit comments