-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(clang-format): add clang-format check workflow
Signed-off-by: João Peixoto <[email protected]>
- Loading branch information
1 parent
ac32018
commit aa8d439
Showing
2 changed files
with
146 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
--- | ||
Language: Cpp | ||
BasedOnStyle: Mozilla | ||
AccessModifierOffset: -2 | ||
AlignAfterOpenBracket: DontAlign | ||
AlignConsecutiveMacros: AcrossEmptyLinesAndComments | ||
AlignConsecutiveAssignments: None | ||
AlignConsecutiveBitFields: None | ||
AlignConsecutiveDeclarations: None | ||
AlignEscapedNewlines: Left | ||
AlignOperands: DontAlign | ||
AlignTrailingComments: | ||
Kind: Always | ||
OverEmptyLines: 2 | ||
AllowAllArgumentsOnNextLine: false | ||
AllowAllParametersOfDeclarationOnNextLine: false | ||
AllowShortEnumsOnASingleLine: true | ||
AllowShortBlocksOnASingleLine: Always | ||
AllowShortCaseLabelsOnASingleLine: false | ||
AllowShortFunctionsOnASingleLine: Empty | ||
AllowShortIfStatementsOnASingleLine: Never | ||
AllowShortLoopsOnASingleLine: false | ||
AlwaysBreakAfterDefinitionReturnType: None | ||
AlwaysBreakAfterReturnType: None | ||
AlwaysBreakBeforeMultilineStrings: false | ||
BinPackArguments: true | ||
BinPackParameters: true | ||
BreakBeforeBraces: Custom | ||
BraceWrapping: | ||
AfterCaseLabel: false | ||
AfterControlStatement: Never | ||
AfterEnum: false | ||
AfterFunction: true | ||
AfterStruct: false | ||
AfterUnion: false | ||
BeforeElse: false | ||
BeforeWhile: false | ||
IndentBraces: false | ||
SplitEmptyFunction: false | ||
SplitEmptyRecord: false | ||
BreakBeforeBinaryOperators: None | ||
BreakBeforeTernaryOperators: false | ||
BreakBeforeInlineASMColon: Never | ||
BreakStringLiterals: true | ||
ColumnLimit: 100 | ||
ContinuationIndentWidth: 4 | ||
DerivePointerAlignment: false | ||
DisableFormat: false | ||
ExperimentalAutoDetectBinPacking: false | ||
IncludeBlocks: Preserve | ||
IndentCaseBlocks: false | ||
IndentCaseLabels: true | ||
IndentGotoLabels: false | ||
IndentPPDirectives: None | ||
IndentWidth: 4 | ||
IndentWrappedFunctionNames: false | ||
InsertBraces: true | ||
InsertNewlineAtEOF: true | ||
InsertTrailingCommas: None | ||
KeepEmptyLinesAtEOF: false | ||
KeepEmptyLinesAtTheStartOfBlocks: false | ||
LineEnding: LF | ||
MacroBlockBegin: '' | ||
MacroBlockEnd: '' | ||
MaxEmptyLinesToKeep: 1 | ||
PenaltyBreakAssignment: 2 | ||
PenaltyBreakBeforeFirstCallParameter: 100 | ||
PenaltyBreakComment: 10 | ||
PenaltyBreakFirstLessLess: 10 | ||
PenaltyBreakOpenParenthesis: 100 | ||
PenaltyBreakString: 100 | ||
PenaltyBreakTemplateDeclaration: 10 | ||
PenaltyExcessCharacter: 50 | ||
PenaltyReturnTypeOnItsOwnLine: 100 | ||
PointerAlignment: Left | ||
# Not using QualigierAlignment as it seems only to affect parameter lists, not | ||
# variable declarations. May enable it if this changes in future clang-format | ||
# versions. | ||
# QualifierAlignment: Custom | ||
# QualifierOrder: ['static', 'inline', 'type', 'const', 'volatile'] | ||
ReflowComments: true | ||
RemoveBracesLLVM: false | ||
RemoveParentheses: MultipleParentheses | ||
RemoveSemicolon: true | ||
SeparateDefinitionBlocks: Leave | ||
SortIncludes: false | ||
SpaceAfterCStyleCast: false | ||
SpaceAfterLogicalNot: false | ||
SpaceAroundPointerQualifiers: Default | ||
SpaceBeforeAssignmentOperators: true | ||
SpaceBeforeInheritanceColon: true | ||
SpaceBeforeParens: ControlStatements | ||
SpaceBeforeRangeBasedForLoopColon: false | ||
SpaceInEmptyBlock: true | ||
SpacesInParens: Custom | ||
SpacesInParensOptions: | ||
InConditionalStatements: false | ||
InEmptyParentheses: false | ||
InCStyleCasts: false | ||
Other: false | ||
SpacesBeforeTrailingComments: 1 | ||
SpacesInSquareBrackets: false | ||
SpaceBeforeSquareBrackets: false | ||
Standard: Latest | ||
StatementMacros: | ||
- Q_UNUSED | ||
- QT_REQUIRE_VERSION | ||
TabWidth: 4 | ||
UseTab: Never | ||
WhitespaceSensitiveMacros: | ||
- STRINGIZE | ||
- PP_STRINGIZE | ||
- BOOST_PP_STRINGIZE | ||
ForEachMacros: ['list_foreach'] | ||
# TODO: | ||
# - IncludeCategories | ||
# - IncludeIsMainRegex | ||
# - IncludeIsMainSourceRegex | ||
... |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Clang Format Check | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
clang-format-check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
# Step 1: Checkout the code from the repository | ||
- name: Checkout the code | ||
uses: actions/checkout@v3 | ||
|
||
# Step 2: Install clang-format 20.0.0 | ||
- name: Install clang-format | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y clang-format | ||
# Step 3: Run clang-format | ||
- name: Run clang-format check | ||
run: | | ||
FILES_TO_CHECK=$(find . -name "*.c" -o -name "*.h") | ||
clang-format -i $FILES_TO_CHECK --dry-run --Werror |