Add code formatting infrastructure#397
Open
matt-gretton-dann wants to merge 6 commits into
Open
Conversation
d4c07bf to
cecd109
Compare
added 4 commits
June 18, 2020 15:32
This adds a workflow that will automatically clang-format any code on a pull_request.
This is the automatic part of applying clang-format. Not everything may build yet.
cecd109 to
9ac2541
Compare
added 2 commits
June 18, 2020 15:44
Clang format rearranged some of the header includes which highlighted some build issues.
The clangformat auto-applied patch produced some untidily formatted comments. This commit tidies up the ones I spotted.
9ac2541 to
5648898
Compare
Contributor
|
As I said in the previous thread: tabs make changelogs look bad by default and thus require additional user work. Unless you customize the tab size in Git diffs, they won't be displayed as you intended. |
zebmason
suggested changes
Jul 9, 2020
| ColumnLimit: 100 | ||
| IndentWidth: 2 | ||
| Language: Cpp | ||
| Standard: Cpp11 |
Contributor
There was a problem hiding this comment.
Shouldn't Standard be Cpp14?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR adds a .clang-format file to format code at the top-level and enforces it using a GitHub Action.
On Windows modern versions of Visual Studio should pick up the .clang-format file as well and automatically format code when saved.
The formatting choices made are based on Microsoft's defaults for Visual Studio. Of interest though will be the choices between tabs & spaces, indent width and max line length.
I have chosen tabs with an indent of 2 spaces per-tab. This is what we've had previously, but I'm interested in any other thoughts @NeilFerguson, @dlaydon, @weshinsley.
On line length - I've picked 100, as that is what the Linux Kernel has recently moved to, and my view is that I start losing context on longer lines. Again up for discussion.