Skip to content

Add Git hooks to format code automically#197

Open
lpottier wants to merge 4 commits into
developfrom
features/git-hooks
Open

Add Git hooks to format code automically#197
lpottier wants to merge 4 commits into
developfrom
features/git-hooks

Conversation

@lpottier
Copy link
Copy Markdown
Member

@lpottier lpottier commented Jun 4, 2026

This PR adds Git hooks for Clang format and Clang Tidy.

To add the hook, you can run: git config core.hooksPath .githooks
Otherwise, our CMake will add the hook automatically upon building.

the .githook/pre-commit script leverages a few environment variables:

  • AMS_SKIP_TIDY if set, skip tidy, still run format. Example: AMS_SKIP_TIDY=1 git commit
  • AMS_BUILD_DIR points to the build directory if you are not using something like build-* or build. Mandatory for clang-tidy.

If you want to deactivate all hooks: git commit --no-verify.
If you want to run the hook without committing: .githook/pre-commit

lpottier added 2 commits June 4, 2026 12:26
Signed-off-by: Loic Pottier <pottier1@llnl.gov>
Signed-off-by: Loic Pottier <pottier1@llnl.gov>
@lpottier lpottier requested a review from YohannDudouit June 4, 2026 22:43
Signed-off-by: Loic Pottier <pottier1@llnl.gov>
Signed-off-by: Loic Pottier <pottier1@llnl.gov>
@lpottier lpottier deployed to github-pages June 5, 2026 00:36 — with GitHub Actions Active
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant