New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update clang format rules #1215
Update clang format rules #1215
Conversation
.clang-format
Outdated
|
||
# when wrapping function calls/declarations, force each parameter to have its own line | ||
BinPackParameters: 'true' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Example:
void foo(int arg1,
int arg2,
int arg3);
Notice that this isn't allowed with this rule:
void foo(int arg1,
int arg2, int arg3);
If such a declaration/function call wraps, this rule enforces that each param is on its own line. Feel free to object.
21f236b
to
8ed4631
Compare
This is a good resource for anyone who wants to play with style rules: |
Note: the pre-commit hook mentioned above will use whatever version |
TODO:
However, it seems that version 9 has correct behavior -- so perhaps we want to move to |
This submodule provides git hooks which invoke clang-format in intelligent ways.
This commit reflects changes to clang-format rules. Unfortunately, these rule changes create a massive change to the codebase, which causes an apparent rewrite of git history. Git blame's --ignore-rev flag can be used to ignore this commit when attempting to `git blame` some code.
0b35491
to
2732709
Compare
This updates
clang-format
rules. Unfortunately, sinceclang-format
aggressively enforces its rules (it is never tolerant; that is, for any given rule, it always enforces some style), this change alone would require an enormous diff to the codebase (a "git blame wall", as Jeff called it).So this also introduces
git-clang-format
(part of the typicalclang-format
distribution) and agit pre-commit
hook script found in the following submodule:external/clang-format-hooks -> https://github.com/barisione/clang-format-hooks/
This (currently) requires a one-time setup per clone:
Once this is done, any
git commit
will pause with an interactive question about applying theclang-format
rules. Example:Remaining tasks:
install
mentioned above. Worst case: invoke fromMakefile
?CI
to usegit-clang-format
so that it only enforces relevant changes.