Skip to content

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

Merged
merged 11 commits into from
Apr 22, 2021

Conversation

DellaBitta
Copy link
Contributor

@DellaBitta DellaBitta commented Apr 19, 2021

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.

@google-cla google-cla bot added the cla: yes label Apr 19, 2021
@DellaBitta DellaBitta changed the title Code Format using clang-format's Google stye defaults. Code Format using clang-format's Google style defaults. Apr 19, 2021
@DellaBitta DellaBitta marked this pull request as ready for review April 19, 2021 15:21
Copy link
Contributor

@alexames alexames left a 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.

: getenv("LC_CTYPE")
? getenv("LC_CTYPE")
: getenv("TEST_TMPDIR") ? "en_US" : "";
std::string output = std::locale().name() != "C" ? std::locale().name()
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

.Construct(1)
.CopyAndMove(2, 1)
.Destruct(4);
SetupExpectCall().Construct(1).CopyAndMove(2, 1).Destruct(4);
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@DellaBitta
Copy link
Contributor Author

DellaBitta commented Apr 20, 2021

Added some clang-format on / off toggles around code which flows better in the authored state.
Also removed the firestore/.clang-format file. I had pulled it in from their repo but it causes clang-format to produce more source code changes than our standard baseline .clang-format file.

@DellaBitta DellaBitta added the tests-requested: quick Trigger a quick set of integration tests. label Apr 20, 2021
@github-actions github-actions bot added tests: in-progress This PR's integration tests are in progress. and removed tests-requested: quick Trigger a quick set of integration tests. labels Apr 20, 2021
@github-actions
Copy link

github-actions bot commented Apr 20, 2021

✅  Integration test succeeded!

Requested by @DellaBitta on commit f27d696
Last updated: Tue Apr 20 12:17:47 PDT 2021
View integration test results

@DellaBitta DellaBitta requested a review from alexames April 20, 2021 17:29
@firebase-workflow-trigger firebase-workflow-trigger bot removed the tests: in-progress This PR's integration tests are in progress. label Apr 20, 2021
@github-actions github-actions bot added the tests: succeeded This PR's integration tests succeeded. label Apr 20, 2021
Copy link
Contributor

@alexames alexames left a 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.

@DellaBitta
Copy link
Contributor Author

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.

@DellaBitta DellaBitta merged commit b43e145 into main Apr 22, 2021
@DellaBitta DellaBitta deleted the feature/ddb-format-google3 branch April 22, 2021 13:35
@firebase firebase locked and limited conversation to collaborators May 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes tests: succeeded This PR's integration tests succeeded.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants