Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I think that can be useful to have a format style for the code base, in order to be more readable and maintainable.
I propose to use clang-format because it is largely used and customizable.
I add the
.clang-format
that defines the used style. The style is based on the LLVM one but without the sorting of the includes to avoid compilation errors and the reflow of the comments to avoid breaking some ASCII figures in the comments. I also add some other options to inline short if and loops.In order to run the code formatting, install clang-format (e.g.,
apt install clang-format
) and run the script with./scripts/format.sh
to apply the style to all files.Note: By default, the LLVM style sets the indentation width to 2 spaces, it is possible to change it to 4 spaces but I think that it makes the code more difficult to read.