wasm-c-api icon indicating copy to clipboard operation
wasm-c-api copied to clipboard

Use clang-format to format API code

Open AndrewScheidecker opened this issue 5 years ago • 5 comments

This would make it much easier for collaborators to ensure their changes have formatting that is consistent with the rest of the repo.

I'm locally using a .clang-format that just contains BasedOnStyle: Chromium, which is reasonably close to the existing code, but not perfect. Ideally @rossberg could add a .clang-format based on his preferences, and apply it to the existing code.

AndrewScheidecker avatar Jun 19 '19 15:06 AndrewScheidecker

Yeah, I understand the suggestion, but I'm sorry to say that my prior exposure has elicited an allergy to clang-format. Symptoms are cringing pain and curling toe nails when exposed to algorithmic stupor steam-rolling over aesthetics. :)

Is the amount of code contributions to expect for this repo large enough that formatting would likely be a problem?

rossberg avatar Jun 19 '19 16:06 rossberg

Yeah, I understand the suggestion, but I'm sorry to say that my prior exposure has elicited an allergy to clang-format. Symptoms are cringing pain and curling toe nails when exposed to algorithmic stupor steam-rolling over aesthetics. :)

I understand your feeling, and after using clang-format for a while on WAVM, am still disappointed with the way it formats certain things. But it's also liberating to accept the automatic formatting and focus on more important issues.

Is the amount of code contributions to expect for this repo large enough that formatting would likely be a problem?

I don't know, but this repo will need to continue to evolve with WebAssembly.

AndrewScheidecker avatar Jun 19 '19 18:06 AndrewScheidecker

I understand your feeling, and after using clang-format for a while on WAVM, am still disappointed with the way it formats certain things. But it's also liberating to accept the automatic formatting and focus on more important issues.

Big +1 to this.

Is the amount of code contributions to expect for this repo large enough that formatting would likely be a problem?

For me this is the only thing that matters; making collaboration easier is much more important than any one person's sense of aesthetics. Obviously, whether formatting is a "problem" could also be subjective; but the cost is small, and adding formatting early is easier than doing it later (e.g. in response to disagreement) when there's a lot of existing code.

dschuff avatar Jun 19 '19 20:06 dschuff

Could you upload a PR with the changes that result for formatting with BasedOnStyle: Chromium so we can see how intrusive it would be?

sbc100 avatar Oct 31 '19 19:10 sbc100

Could you upload a PR with the changes that result for formatting with BasedOnStyle: Chromium so we can see how intrusive it would be?

@sbc100 See #115.

AndrewScheidecker avatar Nov 01 '19 11:11 AndrewScheidecker