Skip to content

Commit

Permalink
clang-format: Update to 16
Browse files Browse the repository at this point in the history
  • Loading branch information
FintasticMan committed Oct 10, 2024
1 parent 8598142 commit c34df9a
Show file tree
Hide file tree
Showing 75 changed files with 6,191 additions and 1,408 deletions.
46 changes: 25 additions & 21 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,22 @@
Language: Cpp
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignConsecutiveMacros: true
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignConsecutiveMacros: true
AlignEscapedNewlines: Right
AlignOperands: Align
AlignTrailingComments: true
AlignTrailingComments:
Kind: Always
OverEmptyLines: 0
AllowAllArgumentsOnNextLine: false
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortLambdasOnASingleLine: None
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: None
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
Expand All @@ -28,29 +30,30 @@ BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterExternBlock: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
IndentBraces: true
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
SplitEmptyRecord: true
BreakAfterAttributes: Never
BreakAfterJavaFieldAnnotations: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakConstructorInitializersBeforeComma: false
BreakInheritanceList: BeforeColon
BreakStringLiterals: true
ColumnLimit: 140
CommentPragmas: '^ IWYU pragma:'
CommentPragmas: "^ IWYU pragma:"
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 2
Expand All @@ -75,24 +78,26 @@ IncludeCategories:
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
SortPriority: 0
- Regex: '.*'
- Regex: ".*"
Priority: 1
SortPriority: 0
IncludeIsMainRegex: '(Test)?$'
IncludeIsMainSourceRegex: ''
IncludeIsMainRegex: "(Test)?$"
IncludeIsMainSourceRegex: ""
IndentAccessModifiers: false
IndentCaseLabels: true
IndentGotoLabels: true
IndentPPDirectives: BeforeHash
IndentWidth: 2
IndentWrappedFunctionNames: false
# Requires Clang >= 15, could also cause incorrect code formatting:
# InsertBraces: true
# Could lead to incorrect formatting, but I think that the tradeoff is worth it
InsertBraces: true
InsertNewlineAtEOF: true
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd: ''
LineEnding: LF
MacroBlockBegin: ""
MacroBlockEnd: ""
MaxEmptyLinesToKeep: 1
NamespaceIndentation: All
PackConstructorInitializers: NextLine
Expand All @@ -107,35 +112,34 @@ PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Left
ReferenceAlignment: Pointer
ReflowComments: true
RemoveSemicolon: true
SeparateDefinitionBlocks: Always
SortIncludes: false
SortUsingDeclarations: true
SpaceAfterCStyleCast: true
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceAroundPointerQualifiers: Default
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: true
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatementsExceptForEachMacros
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInConditionalStatement: false
SpacesInContainerLiterals: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceBeforeSquareBrackets: false
SpaceAroundPointerQualifiers: Default
Standard: Latest
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 8
UseCRLF: false
UseTab: Never
...
78 changes: 39 additions & 39 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ name: Code formatting

on:
pull_request:
branches: [ main ]
branches: [main]
paths:
- '**.cpp'
- '**.h'
- '!src/libs/**'
- '!src/FreeRTOS/**'
- "src/**.cpp"
- "src/**.h"
- "!src/libs/**"
- "!src/FreeRTOS/**"

jobs:
test-format:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 1000

Expand All @@ -23,48 +23,48 @@ jobs:
- name: Install clang-format
run: |
sudo apt-get update
sudo apt-get -y install clang-format-14
sudo apt-get -y install clang-format-16
- name: Check formatting
run: tests/test-format.sh

- name: Upload patches
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: failure()
with:
name: Patches
path: ./*.patch
test-clang-tidy:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
container:
image: infinitime/infinitime-build
steps:
# This workaround fixes the error "unsafe repository (REPO is owned by someone else)".
# See https://github.com/actions/checkout/issues/760 and https://github.com/actions/checkout/issues/766
# The fix in "actions/checkout@v2" was not sufficient as the build process also uses git (to get the current
# commit hash, for example).
- name: Workaround permission issues
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Checkout source files
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 1000
- name: Fetch base branch
run: git fetch origin "$GITHUB_BASE_REF":"$GITHUB_BASE_REF"
- name: Install clang-tidy
run: |
apt-get update
apt-get -y install clang-tidy-14
- name: Prepare environment
shell: bash
env:
SOURCES_DIR: .
run: |
. docker/build.sh
GetGcc
# I guess these already exist inside the docker?
#GetNrfSdk
#GetMcuBoot
CmakeGenerate
- run: tests/test-tidy.sh
# This workaround fixes the error "unsafe repository (REPO is owned by someone else)".
# See https://github.com/actions/checkout/issues/760 and https://github.com/actions/checkout/issues/766
# The fix in "actions/checkout@v2" was not sufficient as the build process also uses git (to get the current
# commit hash, for example).
- name: Workaround permission issues
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Checkout source files
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 1000
- name: Fetch base branch
run: git fetch origin "$GITHUB_BASE_REF":"$GITHUB_BASE_REF"
- name: Install clang-tidy
run: |
apt-get update
apt-get -y install clang-tidy-16
- name: Prepare environment
shell: bash
env:
SOURCES_DIR: .
run: |
. docker/build.sh
GetGcc
# I guess these already exist inside the docker?
#GetNrfSdk
#GetMcuBoot
CmakeGenerate
- run: tests/test-tidy.sh
Loading

0 comments on commit c34df9a

Please sign in to comment.