Changeset View
Changeset View
Standalone View
Standalone View
doc/developer-notes.md
Developer Notes | Developer Notes | ||||
=============== | =============== | ||||
<!-- markdown-toc start --> | <!-- markdown-toc start --> | ||||
**Table of Contents** | **Table of Contents** | ||||
- [Developer Notes](#developer-notes) | - [Developer Notes](#developer-notes) | ||||
- [Coding Style](#coding-style) | - [Coding Style (General)](#coding-style-general) | ||||
- [Coding Style (C++)](#coding-style-c) | |||||
- [Doxygen comments](#doxygen-comments) | - [Doxygen comments](#doxygen-comments) | ||||
- [Coding Style (Python)](#coding-style-python) | |||||
- [Development tips and tricks](#development-tips-and-tricks) | - [Development tips and tricks](#development-tips-and-tricks) | ||||
- [Compiling for debugging](#compiling-for-debugging) | - [Compiling for debugging](#compiling-for-debugging) | ||||
- [Compiling for gprof profiling](#compiling-for-gprof-profiling) | - [Compiling for gprof profiling](#compiling-for-gprof-profiling) | ||||
- [debug.log](#debuglog) | - [debug.log](#debuglog) | ||||
- [Writing tests](#writing-tests) | - [Writing tests](#writing-tests) | ||||
- [Writing script integration tests](#writing-script-integration-tests) | - [Writing script integration tests](#writing-script-integration-tests) | ||||
- [Testnet and Regtest modes](#testnet-and-regtest-modes) | - [Testnet and Regtest modes](#testnet-and-regtest-modes) | ||||
- [DEBUG_LOCKORDER](#debug_lockorder) | - [DEBUG_LOCKORDER](#debug_lockorder) | ||||
Show All 18 Lines | - [Development guidelines](#development-guidelines) | ||||
- [Unit tests](#unit-tests) | - [Unit tests](#unit-tests) | ||||
- [Third party libraries](#third-party-libraries) | - [Third party libraries](#third-party-libraries) | ||||
- [Git and GitHub tips](#git-and-github-tips) | - [Git and GitHub tips](#git-and-github-tips) | ||||
- [RPC interface guidelines](#rpc-interface-guidelines) | - [RPC interface guidelines](#rpc-interface-guidelines) | ||||
- [Internal interface guidelines](#internal-interface-guidelines) | - [Internal interface guidelines](#internal-interface-guidelines) | ||||
<!-- markdown-toc end --> | <!-- markdown-toc end --> | ||||
Coding Style | Coding Style (General) | ||||
--------------- | ---------------------- | ||||
Various coding styles have been used during the history of the codebase, | Various coding styles have been used during the history of the codebase, | ||||
and the result is not very consistent. However, we're now trying to converge to | and the result is not very consistent. However, we're now trying to converge to | ||||
a single style, so please use it in new code. Old code will be converted | a single style, so please use it in new code. Old code will be converted | ||||
gradually and a handful of linters will help you to clean up your patches before | gradually and a handful of linters will help you to clean up your patches before | ||||
submitting them for review. These linters are run automatically when using | submitting them for review. These linters are run automatically when using | ||||
`arc diff` but can also be explicitly called with `arc lint`. | `arc diff` but can also be explicitly called with `arc lint`. | ||||
Coding Style (C++) | |||||
------------------ | |||||
- Basic rules specified in [src/.clang-format](/src/.clang-format). | - Basic rules specified in [src/.clang-format](/src/.clang-format). | ||||
- Braces on new lines for namespaces, classes, functions, methods. | - Braces on new lines for namespaces, classes, functions, methods. | ||||
- Braces on the same line for everything else. | - Braces on the same line for everything else. | ||||
- 4 space indentation (no tabs) for every block except namespaces. | - 4 space indentation (no tabs) for every block except namespaces. | ||||
- No indentation for `public`/`protected`/`private` or for `namespace`. | - No indentation for `public`/`protected`/`private` or for `namespace`. | ||||
- No extra spaces inside parenthesis; don't do ( this ) | - No extra spaces inside parenthesis; don't do ( this ) | ||||
- No space after function names; one space after `if`, `for` and `while`. | - No space after function names; one space after `if`, `for` and `while`. | ||||
- Always add braces for block statements (e.g. `if`, `for`, `while`). | - Always add braces for block statements (e.g. `if`, `for`, `while`). | ||||
▲ Show 20 Lines • Show All 138 Lines • ▼ Show 20 Lines | |||||
but if possible use one of the above styles. | but if possible use one of the above styles. | ||||
To build doxygen locally to test changes to the Doxyfile or visualize your comments before landing changes: | To build doxygen locally to test changes to the Doxyfile or visualize your comments before landing changes: | ||||
``` | ``` | ||||
ninja doc-doxygen | ninja doc-doxygen | ||||
# output goes to doc/doxygen/html/ | # output goes to doc/doxygen/html/ | ||||
``` | ``` | ||||
Coding Style (Python) | |||||
--------------------- | |||||
Refer to [functional-tests.md#style-guidelines](functional-tests.md#style-guidelines). | |||||
Development tips and tricks | Development tips and tricks | ||||
--------------------------- | --------------------------- | ||||
### Compiling for debugging | ### Compiling for debugging | ||||
Run `cmake` with `-DCMAKE_BUILD_TYPE=Debug` to add additional compiler flags | Run `cmake` with `-DCMAKE_BUILD_TYPE=Debug` to add additional compiler flags | ||||
that produce better debugging builds. | that produce better debugging builds. | ||||
▲ Show 20 Lines • Show All 941 Lines • Show Last 20 Lines |