Add .clang-format config, provide to super-linter, and apply formatting to codebase #439
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.
55b6bf7 applied clang-format to the codebase, but did not add the configuration file used. This change adds the configuration file,
.clang-format
, and applies clang-format to the codebase. The configuration file is imported from PyTorch, with attribution in comments at the beginning of the file.The config file used seems to line up well with the one used for 55b6bf7, as the diff generated is relatively small. Having the config available will enable contributions going forward to use consistent formatting and avoid having to apply it across the whole codebase again.
To further this aim, I have linked the
.clang-format
into.github/config/lint
, to enable thelint
job in CI to utilise it for formatting checking. Additionally, I have updated the version ofsuper-linter
used in this job to a newer one, as this provides a much newer version ofclang-format
.I have verified the super-linter job locally, using act, and have confirmed it seems to be working fine. For this reason, I suggest that we can re-enable the linting job in CI, to ensure contributions now follow the
.clang-format
.The benefit to this project is that we can have a consistent and clear formatting style, saving time for developers and reviewers by avoiding having to think/argue about formatting - it can simply be applied with a standard tool.