Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use clang-format to format the whole codebase (#278)
Following up on the [clang-format discussion](#274), I now have drafted a PR to reformat the whole code base using the [clang-format](https://clang.llvm.org/docs/ClangFormat.html) tool with its [LLVM preset](https://clang.llvm.org/docs/ClangFormatStyleOptions.html#basedonstyle). Please have a look at the [LLVM coding standards](https://llvm.org/docs/CodingStandards.html) for a description of this style. This PR does: - Reformat the entire code base using clang-format - Add a `.clang-format` configuration file for the project - Add a `.git-blame-ignore-revs` file which hides the reformatting commit from `git blame` and [GitHubs blame web-view](https://docs.github.com/en/repositories/working-with-files/using-files/viewing-a-file#ignore-commits-in-the-blame-view) - Add a `scripts/format-all.sh` script to quickly reformat all C++ source and headers files of the project. - Extends `devcontainer.json` to suggest installing a couple of extensions which are useful for DPsim-related C++ & Python development - This includes an extensions for clang-format to format files on save - Fix a few missing includes which broke compilation after the reformatting This PR does NOT: - Enforce the use of clang-format - Performs any checks if the code is formatted The idea I have is that we are tolerant towards violate the LLVM style for any commits as we want to keep the barrier for new contributors as low as possible. We dont want to drive them away because of failing nit-pick CI checks. Hence, we only reformat the entire code-base from time to time by hand. And of course: I invite all regular contributors to install the [clang-format VSCode extension](https://marketplace.visualstudio.com/items?itemName=xaver.clang-format), so your changes are directly properly formatted when a file is saved. (Btw. this also speeds up our own coding a lot as you will not have to worry ever again about code formatting. Just write as you like, save the file and everything is tidy :D)
- Loading branch information