Skip to content
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

Clang-format proposal #2390

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

GOOG-sergiu
Copy link

In Android, we're depending on MoltenVK as one of our external dependencies.

We occasionally make small modifications for our purposes that would not make sense to be merged back into the upstream.

However, ensuring consistent formatting seems to be a challenge since we can get merge conflicts from the upstream. I wanted to propose a simple clang-format (we're not attached to the formatter in any which way - we would just prefer if there were a formatter).

  • First commit presents a simple clang-format.
  • In my second commit I present the changes to GPUObjects/ *

I am happy to remove the formatting example and for one of the main contributors to apply the formatting changes or if desired I am happy to reformat the whole project if we agree on the format.

I am a bit surprised there isn't a global formatter already - so if I missed that, please just let me know and we will use that.

@CLAassistant
Copy link

CLAassistant commented Nov 7, 2024

CLA assistant check
All committers have signed the CLA.

@etang-cw
Copy link
Contributor

etang-cw commented Dec 5, 2024

I don't think we currently have a global formatter.

Personal formatting preferences:

  • UseTabs: AlignWithSpaces
  • ColumnLimit: 0 (Otherwise clang-format reflows everything to hit the column limit, which makes everything really hard to read. Let the programmer pick where to wrap. This should also reduce the amount of reflowing the initial formatting commit does, which might make it easier to compare the before and after.)
  • AlignTrailingComments: Leave (I've never seen auto-align consistently work. There are too many cases of unrelated comments being next to each other and getting aligned when they shouldn't, or related comments being too far apart and getting not aligned. If we have to support a clang-format before 16, I guess I'd prefer false, but it would be really nice to allow us to align comments ourselves without leaving it up to an auto-aligner.)
  • AlignEscapedNewlines: DontAlign (If you edit on a small window with soft wrap, aligning the backslashes frequently results in them wasting space on their own line. It's nice to be able to use two-column view on a laptop screen and have that be usable.)
  • BraceWrapping: AfterControlStatement: Multiline

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.

3 participants