BrunoLevy/geogram

Use a clang-format file?

Opened this issue · 2 comments

A lot of files in geogram uses a mix of tabs and space for indentation, have trailing whitespaces, etc. This makes it hard to visualize the code when your indent setting in set differently from @BrunoLevy's (I use tab=4 space where I know Bruno likes to use tabs=8 spaces :p). See example screenshot below:

Screen Shot 2023-03-01 at 10 19 57 AM

Applying a clang-format file to the entire codebase is an easy way to get rid of these inconsistencies, at the cost of it destroying some "homemade" code indentation sometimes (but one can always disable clang-format locally by suing // clang-format off and // clang-format on around a block of code).

Or you could just run a script to convert tabs to space and remove trailing whitespaces, whichever solution works best for you!

OMG, I thought I had fixed that, but it comes back ...
... I think I'll run a script.

FWIW I found out a (Windows-only) tool called Clang-Format Detector that will automatically produce a .clang-format config option matching the input coding style.