KhronosGroup / KTX-Software

KTX (Khronos Texture) Library and Tools
Other
834 stars 222 forks source link

WIP prototype clang-format support #889

Closed aqnuep closed 1 month ago

aqnuep commented 3 months ago

This is largely WIP at this point.

aqnuep commented 3 months ago

@MarkCallow, this is still WIP as I still have to update the auto-generated files and their scripts to include /* clang-format off */ in order to avoid auto-formatting them, and add clang-tidy support. However, this branch already includes the following:

Please check the code and let me know whether the new structure and code format seem reasonable to you.

aqnuep commented 2 months ago

@MarkCallow, I did not yet get feedback from you about the proposed code formatting conventions applied in this branch.

Should I maybe create a separate PR first that just moves the external components into the external directory (and update build scripts accordingly) to do this step-by-step?

MarkCallow commented 2 months ago

@MarkCallow, I did not yet get feedback from you about the proposed code formatting conventions applied in this branch.

Sorry. I am a little under the weather so working when I feel up to it. I reckon reviewing this is going to take some extended concentration so I've been putting it off. Hopefully I'll feel up to taking a look tomorrow.

Should I maybe create a separate PR first that just moves the external components into the external directory (and update build scripts accordingly) to do this step-by-step?

That is not necessary.

I remain somewhat concerned that formatting is done as a workflow rather than via a clean filter run when files are commited. I have to think more about potential ramifications of the remove branch becoming different from what one has just pushed.

Are there any editors that can apply the same formatting during editing?

MarkCallow commented 2 months ago

What is the difference between "format" and "tidy"?

aqnuep commented 2 months ago

I remain somewhat concerned that formatting is done as a workflow rather than via a clean filter run when files are commited. I have to think more about potential ramifications of the remove branch becoming different from what one has just pushed.

This is the practice used in other Khronos projects: modify, format (automatically or through explicit call), then commit. CI only checks that the modifications match the formatting rules.

Are there any editors that can apply the same formatting during editing?

Many editors have clang-format built-in, AFAICT, but I always do this manually so I don't have much experience with them.

What is the difference between "format" and "tidy"?

clang-format is only dealing with formatting, while clang-tidy is a "linter" and provides higher level analysis, see: https://clang.llvm.org/extra/clang-tidy/

MarkCallow commented 1 month ago

Shall we close this now that #913 exists?

aqnuep commented 1 month ago

Yes, closing.