Skip to content

Commit

Permalink
Update clang format to match Cabana
Browse files Browse the repository at this point in the history
Only exception is pointer alignment
  • Loading branch information
streeve committed Sep 25, 2024
1 parent 448833d commit 8a406e6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 14 deletions.
3 changes: 3 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ BinPackParameters: true
IndentWidth: 4
SpacesInParentheses: true
BreakConstructorInitializersBeforeComma: true
PointerAlignment: Right
AlwaysBreakAfterReturnType: None
KeepEmptyLinesAtTheStartOfBlocks: false
2 changes: 1 addition & 1 deletion .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ jobs:
- name: Run clang-format style check
uses: jidicula/[email protected]
with:
clang-format-version: '10'
clang-format-version: '14'
16 changes: 3 additions & 13 deletions cmake/FindCLANG_FORMAT.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,7 @@

find_program(CLANG_FORMAT_EXECUTABLE
NAMES clang-format
clang-format-7
clang-format-6.0
clang-format-5.0
clang-format-4.0
clang-format-3.9
clang-format-3.8
clang-format-3.7
clang-format-3.6
clang-format-3.5
clang-format-3.4
clang-format-3.3
clang-format-14
DOC "clang-format executable")
mark_as_advanced(CLANG_FORMAT_EXECUTABLE)

Expand All @@ -38,11 +28,11 @@ if(CLANG_FORMAT_EXECUTABLE)
OUTPUT_VARIABLE clang_format_version
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)

if(clang_format_version MATCHES "^clang-format version .*")
if(clang_format_version MATCHES "^.*clang-format version .*")
# clang_format_version sample: "clang-format version 3.9.1-4ubuntu3~16.04.1
# (tags/RELEASE_391/rc2)"
string(REGEX
REPLACE "clang-format version ([.0-9]+).*"
REPLACE "^.*clang-format version ([.0-9]+).*"
"\\1"
CLANG_FORMAT_VERSION
"${clang_format_version}")
Expand Down

0 comments on commit 8a406e6

Please sign in to comment.