Skip to content

Commit

Permalink
Merge pull request #412 from rosflight/clang-tidy-linter-updates
Browse files Browse the repository at this point in the history
Updated linter and .clang-format for ROS2
  • Loading branch information
bsutherland333 authored Dec 15, 2023
2 parents 8208375 + b071e7c commit 11e8c0a
Show file tree
Hide file tree
Showing 45 changed files with 1,962 additions and 2,696 deletions.
111 changes: 63 additions & 48 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,53 +1,68 @@
---
Language: Cpp
BasedOnStyle: Google
IndentWidth: 2
UseTab: Never
ColumnLimit: 120
BreakBeforeBraces: Custom
BraceWrapping:
AfterClass: true
AfterControlStatement: true
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
AfterExternBlock: true
BeforeCatch: true
BeforeElse: true
IndentBraces: false
PointerAlignment: Left
# ROS2 code style standards
# https://docs.ros.org/en/humble/The-ROS2-Project/Contributing/Code-Style-Language-Versions.html#id3
BasedOnStyle: LLVM
AccessModifierOffset: -2
IndentCaseLabels: false
AlignAfterOpenBracket: Align
BinPackArguments: true
BinPackParameters: false
ExperimentalAutoDetectBinPacking: false
AlignConsecutiveAssignments: None
AlignOperands: DontAlign
AllowAllArgumentsOnNextLine: false
AllowAllConstructorInitializersOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortIfStatementsOnASingleLine: false
AllowShortBlocksOnASingleLine: Always
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Always
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: true
AllowShortFunctionsOnASingleLine: Inline
AlignTrailingComments: true
SpacesBeforeTrailingComments: 1
FixNamespaceComments: true
AlwaysBreakAfterReturnType: None
AlwaysBreakTemplateDeclarations: Yes
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: false
AfterClass: true
AfterControlStatement: Never
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterStruct: true
AfterUnion: true
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: true
BreakBeforeBinaryOperators: NonAssignment
BreakConstructorInitializers: AfterColon
ConstructorInitializerIndentWidth: 2

IncludeBlocks: Regroup
IncludeCategories:
- Regex: '"rosflight\.h"'
Priority: 3
- Regex: '"interface\/[[:alnum:]_]+\.h"'
Priority: 1
- Regex: '<turbomath\/[[:alnum:]_]+\.h>'
Priority: 4
- Regex: '<[[:alpha:]]+>'
Priority: 6
- Regex: '<.*>'
Priority: 5
- Regex: '".*"'
Priority: 2
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeComma
BreakInheritanceList: BeforeColon
ColumnLimit: 100
CompactNamespaces: false
ContinuationIndentWidth: 2
IndentCaseLabels: true
IndentPPDirectives: None
IndentWidth: 2
KeepEmptyLinesAtTheStartOfBlocks: true
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: false
PointerAlignment: Middle
ReflowComments: false
SpaceAfterCStyleCast: true
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
TabWidth: 2
UseTab: Never
9 changes: 5 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- uses: DoozyX/clang-format-lint-action@v0.5
- uses: actions/checkout@v2
- uses: DoozyX/clang-format-lint-action@v0.16.2
with:
source: '.'
extensions: 'h,cpp'
clangFormatVersion: 6
extensions: 'h,hpp,cpp'
exclude: './boards/*/lib'
clangFormatVersion: 16
Loading

0 comments on commit 11e8c0a

Please sign in to comment.