Skip to content

Clang‐format

Christian Glusa edited this page Dec 19, 2023 · 9 revisions

This page contains some notes for working with clang-format.

clang-format script

TODO

git pre-commit hooks

Create a file .pre-commit-config.yaml in the root of the Trilinos source tree:

files: "packages/muelu/.*pp"
repos:
-   repo: https://github.com/pre-commit/mirrors-clang-format
    rev: v14.0.1
    hooks:
    - id: clang-format
      types_or: [c++, c, cuda]

Then install pre-commit via

python3 -m pip install pre-commit
pre-commit install

Ignoring large commits

The first run of clang-format can make a lot of changes. In order to not spoil git-blame we maintain a list of these commits in .git-blame-ignore-revs. In order to configure git to ignore them, simply do:

git config blame.ignoreRevsFile .git-blame-ignore-revs
Clone this wiki locally