daphne-eu / daphne

DAPHNE: An Open and Extensible System Infrastructure for Integrated Data Analysis Pipelines
Apache License 2.0
67 stars 62 forks source link

Introduce .clang-format file #723

Closed philipportner closed 2 months ago

philipportner commented 6 months ago

This PR aims to introduce a .clang-format file in order to have automated consistent code formatting for supported languages. For DAPHNE this mainly aims to do so for C, C++ and TableGen files. clang-format is the standard tool to provide consistent formatting across C and C++ code bases and is supported by almost every editor and IDE out there (e.g., automatically recognized by Clion/VScode).

It even has integration with git itself.

The following steps would need to be completed:

I don't really care which format we use, main thing is consistency. I added the LLVM style for now since that makes the most sense for me with our dependency on LLVM.

Happy to discuss specifics and feel free to ask any questions and please let me know if there's more steps needed.

https://clang.llvm.org/docs/ClangFormat.html

corepointer commented 6 months ago

Thx for initiating discussion on coding style :+1: We've been avoiding it for far too long ;-) :see_no_evil:

philipportner commented 5 months ago

To ignore whitespace changes with git blame one has to pass the -w option as argument, e.g., git blame -w path_to_file.

https://www.git-scm.com/docs/git-blame

pdamme commented 5 months ago

This PR is related to #70 and perhaps to #16.

corepointer commented 2 months ago

In the future, please add a reference to the GitHub discussion to the commit message before merging to main. Something like "[DAPHNE-#723] Introduce .clang-format file"

corepointer commented 2 months ago

And maybe we could have a mention in the contribution guidelines on how to use it :nerd_face:

philipportner commented 2 months ago

And maybe we could have a mention in the contribution guidelines on how to use it 🤓

Yes, I'll do that. Thanks