Skip to content

Commit

Permalink
update doc on pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
KrisThielemans committed Nov 7, 2024
1 parent d83c3db commit be1f6e1
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
8 changes: 6 additions & 2 deletions documentation/devel/editor-settings.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Developer documentation: editor settings

White-spaces and indentation with multiple developers are a pain. Please adhere to
our white-space policy, which we try to enforce via [clang-format](https://clang.llvm.org/docs/ClangFormat.html).
Check that site for integration with your editor/IDE.
our white-space policy, which we enforce via [pre-commit](https://pre-commit.com/), including
running of [clang-format](https://clang.llvm.org/docs/ClangFormat.html).
See [git-hooks.md](git-hooks.md) for more information.

Developer experience will be best if you set your editor/IDE to use the same settings,
including versions of the formatters (`clang-format` in particular).
22 changes: 19 additions & 3 deletions documentation/devel/git-hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,27 @@
We use [pre-commit](https://pre-commit.com) to check coding conventions, including
white-space formatting rules.

Unfortunately, exact formatting used depends on the `clang-format` version. Therefore,
you do have to install the same version as what is currently used in our GitHub Action.
Unfortunately, exact formatting used depends on the `clang-format` (and others?) version. Therefore,
you might need to install the same version as what is currently used in our
[.pre-commit-config.yaml](../../.pre-commit-config.yaml) for your editor to pick up
the same version.

## Installation of software

### TL;DR

```sh
pip/conda install pre-commit
git add blabla
pre-commit run
# optionally check files
# "add" changes made by the hooks
git add blabla
git commit
```

### More detail

We highly recommend to use `conda`:
```sh
cd /whereever/STIR
Expand Down Expand Up @@ -48,4 +64,4 @@ or one-off with

git commit --no-verify

You will then need to run `pre-commit run --all-files` when done before we will merge your pull request.
You will then need to run `pre-commit run --all-files` when done before we will merge your pull request.

0 comments on commit be1f6e1

Please sign in to comment.