Skip to content

Add Clang format - #60

Open
ZXShady wants to merge 2 commits into
anjo76:masterfrom
ZXShady:clang_format
Open

Add Clang format#60
ZXShady wants to merge 2 commits into
anjo76:masterfrom
ZXShady:clang_format

Conversation

@ZXShady

@ZXShady ZXShady commented Mar 20, 2026

Copy link
Copy Markdown
Contributor

I have added clang format to the codebase and tried as hard to preserve most formatting, sadly clang format does not support every single possible configuration so this is as close as I got. I seperated the addition of the clang format file into a seperate commit, if you don't want to reformat old code

@codecat

codecat commented Mar 21, 2026

Copy link
Copy Markdown

Err, yeah this should not be merged as-is. By all means @anjo76 should do the formatting themselves, but 17k loc changes is not something that should be merged by a random contributor 😅

I haven't looked at the actual diff itself, why is there still so many differences?

@ZXShady

ZXShady commented Mar 21, 2026

Copy link
Copy Markdown
Contributor Author

Err, yeah this should not be merged as-is. By all means @anjo76 should do the formatting themselves, but 17k loc changes is not something that should be merged by a random contributor 😅

That is why it is a seperate commit, you can revrrt it only.

I haven't looked at the actual diff itself, why is there still so many differences?

Thecodebase itself wasn't consistent e.g in some places it used if (...) and others which used if(...) (no space) and some places used T *p and some others used T* p the codebase wasn't consistent in itself.

and clang formst removes extra spaces from end of lines

Comment thread .clang-format
AllowShortIfStatementsOnASingleLine: AllIfsAndElse

IndentCaseLabels: true
IndentPPDirectives: BeforeHash

@HenryAWE HenryAWE Mar 21, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Maybe set IndentPPDirectives to None is better?
It looks like that the original code base isn't indenting the preprocessor lines.

@literary-programmer

Copy link
Copy Markdown

Since the angel is used for some critical operations, instead of receiving a PR from a contributor. I would request that the original dev uses some formatter to clean the code.
Plus, I don't feel like cleaning up the code like this should be very high priority.

@ZXShady

ZXShady commented Mar 22, 2026

Copy link
Copy Markdown
Contributor Author

Since the angel is used for some critical operations, instead of receiving a PR from a contributor. I would request that the original dev uses some formatter to clean the code.

He can do it gimself, that's why the commits are seperated you can revert one or the other.

Plus, I don't feel like cleaning up the code like this should be very high priority.

Given this project is now on github I think making the entry level for contribution easier is a good thing.

@anjo76

anjo76 commented Mar 23, 2026

Copy link
Copy Markdown
Owner

I like the idea of having a file that allows others to format their contributions to be more similar to my coding style. Thanks for providing this. I'll definitely take a closer look at this.

However, I have no intention of doing a full automated formatting of the code base. At most automated formatting should only be used when something is already being modified at that place.

@anjo76 anjo76 added the enhancement New feature or request label Mar 23, 2026
@anjo76 anjo76 self-assigned this Mar 23, 2026
@anjo76

anjo76 commented Mar 23, 2026

Copy link
Copy Markdown
Owner

Digging in to this a bit more I found out that MSVC has support for using clang-format. I never really looked into the auto formatting before.

I'll tinker with this a bit to see if I can get something to my liking and commit the file.

@ZXShady

ZXShady commented Mar 24, 2026

Copy link
Copy Markdown
Contributor Author

Digging in to this a bit more I found out that MSVC has support for using clang-format. I never really looked into the auto formatting before.

I'll tinker with this a bit to see if I can get something to my liking and commit the file.

Yea I use it, I recommend you taking control of this pr and figuring out the style you want because I can't really figure it out all myself but this should be a starting point.

what vs version do you use btw? It seems to be 2022 since I noticed you don't have 2026 files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants