Git fork

Merge branch 'kn/clang-format-updates'

Update ".clang-format" and ".editorconfig" to match our style guide
a bit better.

* kn/clang-format-updates:
meson: add rule to run 'git clang-format'
clang-format: add 'RemoveBracesLLVM' to the main config
clang-format: set 'ColumnLimit' to 0

+28 -29
+15 -12
.clang-format
··· 12 12 TabWidth: 8 13 13 IndentWidth: 8 14 14 ContinuationIndentWidth: 8 15 - ColumnLimit: 80 15 + 16 + # While we do want to enforce a character limit of 80 characters, we often 17 + # allow lines to overflow that limit to prioritize readability. Setting a 18 + # character limit here with penalties has been finicky and creates too many 19 + # false positives. 20 + # 21 + # NEEDSWORK: It would be nice if we can find optimal settings to ensure we 22 + # can re-enable the limit here. 23 + ColumnLimit: 0 16 24 17 25 # C Language specifics 18 26 Language: Cpp ··· 210 218 # No empty line at the start of a block. 211 219 KeepEmptyLinesAtTheStartOfBlocks: false 212 220 213 - # Penalties 214 - # This decides what order things should be done if a line is too long 215 - PenaltyBreakAssignment: 5 216 - PenaltyBreakBeforeFirstCallParameter: 5 217 - PenaltyBreakComment: 5 218 - PenaltyBreakFirstLessLess: 0 219 - PenaltyBreakOpenParenthesis: 300 220 - PenaltyBreakString: 5 221 - PenaltyExcessCharacter: 10 222 - PenaltyReturnTypeOnItsOwnLine: 300 223 - 224 221 # Don't sort #include's 225 222 SortIncludes: false 223 + 224 + # Remove optional braces of control statements (if, else, for, and while) 225 + # according to the LLVM coding style. This avoids braces on simple 226 + # single-statement bodies of statements but keeps braces if one side of 227 + # if/else if/.../else cascade has multi-statement body. 228 + RemoveBracesLLVM: true
+1 -17
ci/run-style-check.sh
··· 5 5 6 6 baseCommit=$1 7 7 8 - # Remove optional braces of control statements (if, else, for, and while) 9 - # according to the LLVM coding style. This avoids braces on simple 10 - # single-statement bodies of statements but keeps braces if one side of 11 - # if/else if/.../else cascade has multi-statement body. 12 - # 13 - # As this rule comes with a warning [1], we want to experiment with it 14 - # before adding it in-tree. since the CI job for the style check is allowed 15 - # to fail, appending the rule here allows us to validate its efficacy. 16 - # While also ensuring that end-users are not affected directly. 17 - # 18 - # [1]: https://clang.llvm.org/docs/ClangFormatStyleOptions.html#removebracesllvm 19 - { 20 - cat .clang-format 21 - echo "RemoveBracesLLVM: true" 22 - } >/tmp/clang-format-rules 23 - 24 - git clang-format --style=file:/tmp/clang-format-rules \ 8 + git clang-format --style=file:.clang-format \ 25 9 --diff --extensions c,h "$baseCommit"
+12
meson.build
··· 2133 2133 alias_target('check-headers', hdr_check) 2134 2134 endif 2135 2135 2136 + git_clang_format = find_program('git-clang-format', required: false, native: true) 2137 + if git_clang_format.found() 2138 + run_target('style', 2139 + command: [ 2140 + git_clang_format, 2141 + '--style', 'file', 2142 + '--diff', 2143 + '--extensions', 'c,h' 2144 + ] 2145 + ) 2146 + endif 2147 + 2136 2148 foreach key, value : { 2137 2149 'DIFF': diff.full_path(), 2138 2150 'GIT_SOURCE_DIR': meson.project_source_root(),