Skip to content

Adopt style(9) using clang-format#55

Open
mchoo7 wants to merge 1 commit intofreebsd:masterfrom
mchoo7:clang-format
Open

Adopt style(9) using clang-format#55
mchoo7 wants to merge 1 commit intofreebsd:masterfrom
mchoo7:clang-format

Conversation

@mchoo7
Copy link
Contributor

@mchoo7 mchoo7 commented Jan 23, 2024

I find atk's coding style doesn't follow some conventions, such as having space in <> or putting pointer * or reference symbol & with variable types, not variable names.

FreeBSD's coding style style(9) can be applied here. One main exception in style(9) opposed to the "convention" is that style(9) use 8-space indentation while most projects use 4-space indentation. (2-space indentation is predominant in web dev). We can discuss whether or not to use 8-space indentation if needed.

@mchoo7 mchoo7 force-pushed the clang-format branch 3 times, most recently from d0a2168 to a66c981 Compare January 23, 2024 19:46
Copy link
Contributor

@ngie-eign ngie-eign left a comment

Choose a reason for hiding this comment

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

@fel1x-developer : for the sake of pragmatism, I think it's best to apply this change on a per-file basis since this is going to cause a lot of churn for little to no immediate benefit.
Also, there are a number of conflicts that need to be resolved in this change.

@mchoo7 mchoo7 changed the title Adopt style(9) with clang-format Adopt style(9) using clang-format Mar 10, 2024
@ngie-eign
Copy link
Contributor

Was this pulled from FreeBSD? If so, it might be better to figure out a way to keep this file in sync, somehow, instead of it drifting too far from upstream (freebsd-src).

@mchoo7
Copy link
Contributor Author

mchoo7 commented May 9, 2024

Was this pulled from FreeBSD? If so, it might be better to figure out a way to keep this file in sync, somehow, instead of it drifting too far from upstream (freebsd-src).

For now, automatically tracking updates in the freebse-src upstream is impossible. We can use post-commit hook as an alternative.

By the way, the .clang-format file is not updated quite often. It had only 2 major changes in the last 3 years, so I think updating manually from the upstream would be fine.

@ngie-eign
Copy link
Contributor

Could you please add a comment to the file to note where it came from (FreeBSD; git revision <...>)? Thanks :).

@mchoo7 mchoo7 requested a review from ngie-eign June 29, 2024 16:32
@mchoo7 mchoo7 force-pushed the clang-format branch 2 times, most recently from 9dfdf72 to b1e4ae7 Compare December 30, 2024 18:41
@mchoo7
Copy link
Contributor Author

mchoo7 commented Dec 30, 2024

@ngie-eign Sorry this PR was mixed with other unrelated changes I was working on. We only need 1 commit where we bring .clang-format from freebsd-src.

We might need a git hook so people can format files according to .clang-format.

Copy link
Contributor

@ngie-eign ngie-eign left a comment

Choose a reason for hiding this comment

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

I looked at doing a similar change.
I think your proposal to introduce clang-format makes logical sense, but the implementation is a very high-impact/high churn change.
It's best to take the upstream FreeBSD config, and adjust it to match the existing style to reduce churn.
Once the core memory leak issues have been resolved and CI is enabled, I would be game to do widespread reformatting of the source in the repo.

This commit adopts FreeBSD's style(9). This file is retrieved from
https://github.com/freebsd/freebsd-src/blob/main/.clang-format.
Contributers can apply this style on modified files in future changes.

Signed-off-by: Minsoo Choo <minsoochoo0122@proton.me>
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