Commit 148e3169 authored by Lukas Riedel's avatar Lukas Riedel Committed by Santiago Ospina De Los Ríos

Add clang-format-hooks instructions to CONTRIBUTING.md

parent 7e1da159
......@@ -62,18 +62,47 @@ a change. DORiE vendors [Google Test](https://github.com/google/googletest) as
unit test framework. Check out the [Doxygen documentation][doxygen] for
information on how to employ the framework in DORiE.
The DORiE repository contains a `.clang-format` file in the top-level directory specifying the desired style for C++ code in DORiE.
We ask developers to use this style when writing new code, ideally by instructing their editor or Clang-Format tool to do so.
However, we deem readability more important than adhering to a fixed style.
Mixing styles within one file is therefore strongly discouraged.
Developers should also avoid introducing unnecessary changes by formatting code which would otherwise not have been affected by their changes.
After a proper discussion of the issue, and the resulting implementation, open
a merge request. Again, we encourage you to use one of the description
templates. Provide information on how your code changes and additions solve the
problem or implement the feature. Make sure that your MR fulfills the the
criteria for being merged.
#### C++ Coding Style
The DORiE repository contains a `.clang-format` file in the top-level directory specifying the desired style for C++ code in DORiE.
We ask developers to use this style when writing new code, ideally by instructing their editor and/or [ClangFormat](https://clang.llvm.org/docs/ClangFormat.html) tool to do so.
Every change to C++ files introduced by Git commits should be formatted according to this style.
DORiE vendors [clang-format-hooks](https://github.com/barisione/clang-format-hooks) to automate formatting and avoid committing unformated changes.
It contains a Git pre-commit hook which checks the changes right before committing.
If the changes to not comply to the coding style, the user is shown the suggested style and prompted to apply the changes or abort the commit.
Follow these instructions for registering the hook:
1. Install `clang-format`.
On **macOS**:
```bash
brew install clang-format
```
On **Ubuntu**:
```bash
apt install clang-format
```
2. Register the hook. From the top-level DORiE source directory, execute
```bash
./plugins/vendor/clang-format-hooks/git-pre-commit-format install
```
When running in trouble, consult the [original installation instructions](https://github.com/barisione/clang-format-hooks#setup).
Happy coding!
### Releases
Tasks for creating and publishing a release are listed in the `version-rollout`
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment