Skip to content

Apply clang-format to everything#2059

Merged
kripken merged 1 commit intomasterfrom
format
Apr 26, 2019
Merged

Apply clang-format to everything#2059
kripken merged 1 commit intomasterfrom
format

Conversation

@kripken
Copy link
Copy Markdown
Member

@kripken kripken commented Apr 26, 2019

Mass change to apply clang-format to everything. We are applying this in a PR by me so the (git) blame is all mine ;) but @aheejin did all the work to get clang-format set up and all the manual work to tidy up some things to make the output nicer in #2048

Copy link
Copy Markdown
Member

@aheejin aheejin left a comment

Choose a reason for hiding this comment

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

Yay! Thank you for doing this.

@kripken kripken merged commit db9124f into master Apr 26, 2019
@kripken kripken deleted the format branch April 26, 2019 23:59
aheejin added a commit to aheejin/wabt that referenced this pull request Jun 27, 2021
This applies clang-format to the whole codebase.

I noticed we have .clang-format in wabt but the codebase is not very
well formatted. This kind of mass-formatting PR has fans and skeptics
because it can mess with `git blame`, but we did a similar thing in
Binaryen a few years ago (WebAssembly/binaryen#2048, which was merged in
WebAssembly/binaryen#2059) and it was not very confusing after all.
If we are going to ever format the codebase, I think it is easier to do
it in a single big PR than dozens of smaller PRs.

This does not include files in src/prebuilt, because they are generated.

This PR is mainly to listen to opinions and it is OK we end up not
merging this.
aheejin added a commit to aheejin/wabt that referenced this pull request Jun 27, 2021
This applies clang-format to the whole codebase.

I noticed we have .clang-format in wabt but the codebase is not very
well formatted. This kind of mass-formatting PR has fans and skeptics
because it can mess with `git blame`, but we did a similar thing in
Binaryen a few years ago (WebAssembly/binaryen#2048, which was merged in
WebAssembly/binaryen#2059) and it was not very confusing after all.
If we are going to ever format the codebase, I think it is easier to do
it in a single big PR than dozens of smaller PRs.

This does not include files in src/prebuilt, because they are generated.

This PR is mainly to listen to opinions and it is OK we end up not
merging this. (Also even if we end up merging this, I'm not sure if I am
the right person to change this many lines of code, given that I am not
a frequent contributor in this repo.)
aheejin added a commit to aheejin/wabt that referenced this pull request Jun 27, 2021
This applies clang-format to the whole codebase.

I noticed we have .clang-format in wabt but the codebase is not very
well formatted. This kind of mass-formatting PR has fans and skeptics
because it can mess with `git blame`, but we did a similar thing in
Binaryen a few years ago (WebAssembly/binaryen#2048, which was merged in
WebAssembly/binaryen#2059) and it was not very confusing after all.
If we are going to ever format the codebase, I think it is easier to do
it in a single big PR than dozens of smaller PRs.

This does not include files in src/prebuilt, because they are generated.

This PR is mainly to listen to opinions and it is OK we end up not
merging this. (Also even if we end up merging this, I'm not sure if I am
the right person to change this many lines of code, given that I am not
a frequent contributor in this repo.)

I also added a clang-format check hook in the Github CI in WebAssembly#1683, which
I think can be less controversial, given that it only checks the diff.
aheejin added a commit to aheejin/wabt that referenced this pull request Jun 27, 2021
This applies clang-format to the whole codebase.

I noticed we have .clang-format in wabt but the codebase is not very
well formatted. This kind of mass-formatting PR has fans and skeptics
because it can mess with `git blame`, but we did a similar thing in
Binaryen a few years ago (WebAssembly/binaryen#2048, which was merged in
WebAssembly/binaryen#2059) and it was not very confusing after all.
If we are going to ever format the codebase, I think it is easier to do
it in a single big PR than dozens of smaller PRs.

This is using the existing .clang-format file in this repo, which
follows the style of Chromium. If we think this does not suit the
current formatting style, we can potentially tweak .clang-format too.
For example, I noticed the current codebase puts many `case` statements
within a single line when they are short, but the current .clang-format
does not allow that.

This does not include files in src/prebuilt, because they are generated.

This also manually fixes some comment lines, because mechanically
applying clang-format to long inline comments can look weird.

This PR is mainly to listen to opinions and it is OK we end up not
merging this. (Also even if we end up merging this, I'm not sure if I am
the right person to change this many lines of code, given that I am not
a frequent contributor in this repo.)

I also added a clang-format check hook in the Github CI in WebAssembly#1683, which
I think can be less controversial, given that it only checks the diff.
aheejin added a commit to WebAssembly/wabt that referenced this pull request Dec 21, 2021
This applies clang-format to the whole codebase.

I noticed we have .clang-format in wabt but the codebase is not very
well formatted. This kind of mass-formatting PR has fans and skeptics
because it can mess with `git blame`, but we did a similar thing in
Binaryen a few years ago (WebAssembly/binaryen#2048, which was merged in
WebAssembly/binaryen#2059) and it was not very confusing after all.
If we are ever going to format the codebase, I think it is easier to do
it in a single big PR than dozens of smaller PRs.

This is using the existing .clang-format file in this repo, which
follows the style of Chromium. If we think this does not suit the
current formatting style, we can potentially tweak .clang-format too.
For example, I noticed the current codebase puts many `case` statements
within a single line when they are short, but the current .clang-format
does not allow that.

This does not include files in src/prebuilt, because they are generated.

This also manually fixes some comment lines, because mechanically
applying clang-format to long inline comments can look weird.

I also added a clang-format check hook in the Github CI in #1683, which
I think can be less controversial, given that it only checks the diff.

---

After discussions, we ended up reverting many changes, especially
one-liner functions and switch-cases, which are too many to wrap in
`// clang-format off` and `// clang-format on`. I also considered fixing
`.clang-format` to allow those one-liners but it caused a larger churn
in other parts. So currently the codebase does not conform to
`.clang-format` 100%, but we decided it's fine.
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.

2 participants