-
Notifications
You must be signed in to change notification settings - Fork 124
Code Format using clang-format's Google style defaults. #383
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
Conversation
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.
Overall I'm much happier with how this formatting pass went, though I think there are a small handful of places we ought to throw in some // clang-format off/on statements on custom-formatted blocks.
app/src/locale.cc
Outdated
: getenv("LC_CTYPE") | ||
? getenv("LC_CTYPE") | ||
: getenv("TEST_TMPDIR") ? "en_US" : ""; | ||
std::string output = std::locale().name() != "C" ? std::locale().name() |
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.
nit: This is a case where I think the formatter is going to do worse than the nicely formatted table no matter what settings we use. If we go through with committing with these settings, can this block get wrapped in // clang-format off/on
?
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.
Done.
app/tests/optional_test.cc
Outdated
.Construct(1) | ||
.CopyAndMove(2, 1) | ||
.Destruct(4); | ||
SetupExpectCall().Construct(1).CopyAndMove(2, 1).Destruct(4); |
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.
As mentioned above, I think this is a case where having the manual formatting is arguably superior (though I feel less strongly about this one). Another // clang-format off/on?
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.
Done.
Also found a few more.
Added some clang-format on / off toggles around code which flows better in the authored state. |
✅ Integration test succeeded!Requested by @DellaBitta on commit f27d696 |
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.
This looks good to me. The one minor nitpick I have is that I'm not a huge fan of when the formatter decides to line up comments at the end of lines, because it can end up with some awkwardly formatted comments, but I don't think it's worth overriding google style to turn that off.
Yeah, I saw this too and it made me sigh. |
Updated codebase using clang-format's Google style basis without any further one-off customizations.
Clang-format seemingly. does some odd things to objective-c files. Therefore directories known to contain objective-c files are ignored by defining a local .clang-format file which disables clang-format. Objective C .mm files are ignored in mixed-language directories, and Obj-C headers are detected by the format_code.py script which search for Obj-c language tags.