Skip to content

Run clang-format on pre-commit#1213

Merged
hjmjohnson merged 7 commits intoInsightSoftwareConsortium:masterfrom
thewtex:pre-commit-clang-format
Aug 29, 2019
Merged

Run clang-format on pre-commit#1213
hjmjohnson merged 7 commits intoInsightSoftwareConsortium:masterfrom
thewtex:pre-commit-clang-format

Conversation

@thewtex
Copy link
Copy Markdown
Member

@thewtex thewtex commented Aug 28, 2019

Automatically run clang-format on changed, non-third-party C++ files at pre-commit time, and allow the developer to review and test the style changes with the standard git mergetool configuration (see git help mergetool).

This should be merged after #1191 since most of the files in the repository currently have many changes when clang-format is executed.

Copy link
Copy Markdown
Member

@dzenanz dzenanz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't tested this, but looks good.

Comment thread Utilities/Hooks/pre-commit-style.bash
@skalexander
Copy link
Copy Markdown
Contributor

This looks good, all - just catching up on the thread.

Comment thread .gitattributes
* hooks-max-size=100000
Modules/Numerics/FEM/src/dsrc2c.c hooks-max-size=260000
Modules/ThirdParty/** hooks-max-size=300000
Modules/ThirdParty/** hooks-max-size=300000 hooks.style=
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Various improvements and fixes:

- The default merged output is now the output of clang-format.
- KWStyle and clangformat style checks are enabled by default.
- Console input specification fixed for the mergetool.
- Partially staged files without the style hook attributes are
automatically skipped.
Suggested-by: Brad King <brad.king@kitware.com>
Copy link
Copy Markdown
Member

@hjmjohnson hjmjohnson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice Matt.

@hjmjohnson hjmjohnson merged commit b4beb21 into InsightSoftwareConsortium:master Aug 29, 2019
@thewtex thewtex deleted the pre-commit-clang-format branch August 29, 2019 21:52
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.

5 participants