TheLartians / ModernCppStarter

🚀 Kick-start your C++! A template for modern C++ projects using CMake, CI, code coverage, clang-format, reproducible dependency management and much more.
https://thelartians.github.io/ModernCppStarter
The Unlicense
4.33k stars 381 forks source link

Use of deprecated ConstructorInitializerAllOnOneLineOrOnePerLine .clang-format option #169

Open huand opened 1 year ago

huand commented 1 year ago

https://github.com/TheLartians/ModernCppStarter/blob/f0b5bdb1f5c638c7c4c957d626dc9a3460a452e5/.clang-format#L9

Documentation says it's deprecated

I think what you want is

BinPackParameters: false
BinPackArguments: false
ClausKlein commented 1 year ago

IMHO: we should use this: https://clang.llvm.org/docs/ClangFormatStyleOptions.html#packconstructorinitializers

huand commented 1 year ago

Possibly, I'm not well versed in the "most commonly admitted consensual .clang-format practices" so I'll let the decision to others. I was just looking through the definitions and I saw something deprecated which is not the best default i believe for a modern starter.

As a digression I went through the options because originally i wanted to have the & "on the left" for function definitions like auto fn(const Type& x) instead of auto fn(const Type &x) and i believe this .clang-format does not enforce this as it is

DerivePointerAlignment: false
PointerAlignment: Left

I also don't know if this "left alignment" is a standard practice.

TheLartians commented 1 year ago

Thanks for the heads up! I wasn't aware that the option was deprecated. Happy to accept a PR that updates the config without impacting the other style settings much.