Skip to content

Commit

Permalink
Add doc for using clang-format hook
Browse files Browse the repository at this point in the history
  • Loading branch information
daljit46 committed Jul 5, 2023
1 parent 811d982 commit 81e88a9
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,25 @@ A few explicit notes on such:
introduce Windows-style newline characters ("`CR LF`" / "`\r\n`")
will need to be edited accordingly.

- In C++, we use [clang-format](https://clang.llvm.org/docs/ClangFormat.html) 16
to ensure that all C++ code is formatted using the same conventions.
To comply with this requirement, we recommend that you install a local git hook
using [pre-commit](https://pre-commit.com/):

- Install `pre-commit` via `pip install pre-commit` (or via your OS package manager).

- Run `pre-commit install` in the source directory of MRtrix.
NOTE: you may need to add the pip scripts folder to your `PATH`
(you can check where pip has installed the package using `pip show pre-commit`).

This procedure will install a local git hook to ensure that all of your commits
are correctly formatted. If this isn't the case, the commit will fail and an
automatic formatting of the staged changes will be applied. You will then have
to commit those changes again.

Alternatively, you may wish to configure your editor to automatically format
your code using clang-format.

- In Python, variable / class / module names are enforced through
`pylint`. Script "`run_pylint`" in the *MRtrix3* root directory
will test any code modifications against these expectations.
Expand Down

0 comments on commit 81e88a9

Please sign in to comment.