-
Notifications
You must be signed in to change notification settings - Fork 351
checkpatch: remove and use clang-format instead #10619
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,181 @@ | ||
| # SPDX-License-Identifier: GPL-2.0 | ||
| # | ||
| # clang-format configuration file. Intended for clang-format >= 11. | ||
| # | ||
| # For more information, see: | ||
| # | ||
| # Documentation/dev-tools/clang-format.rst | ||
| # https://clang.llvm.org/docs/ClangFormat.html | ||
| # https://clang.llvm.org/docs/ClangFormatStyleOptions.html | ||
| # | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @lgirdwood Should we have a link to the Zephyr version as this is including many definitions from it (and we should probably take in updates from Zephyr if they change converntions)? |
||
| --- | ||
|
||
| AccessModifierOffset: -4 | ||
| AlignAfterOpenBracket: Align | ||
| AlignConsecutiveAssignments: false | ||
| AlignConsecutiveDeclarations: false | ||
| AlignEscapedNewlines: Left | ||
| AlignOperands: true | ||
| AlignTrailingComments: false | ||
| AllowAllParametersOfDeclarationOnNextLine: false | ||
| AllowShortBlocksOnASingleLine: false | ||
| AllowShortCaseLabelsOnASingleLine: false | ||
| AllowShortFunctionsOnASingleLine: None | ||
| AllowShortIfStatementsOnASingleLine: false | ||
| AllowShortLoopsOnASingleLine: false | ||
| AlwaysBreakAfterDefinitionReturnType: None | ||
| AlwaysBreakAfterReturnType: None | ||
| AlwaysBreakBeforeMultilineStrings: false | ||
| AlwaysBreakTemplateDeclarations: false | ||
| BinPackArguments: true | ||
| BinPackParameters: true | ||
| BraceWrapping: | ||
| AfterClass: false | ||
| AfterControlStatement: false | ||
| AfterEnum: false | ||
| AfterFunction: true | ||
| AfterNamespace: true | ||
| AfterObjCDeclaration: false | ||
| AfterStruct: false | ||
| AfterUnion: false | ||
| AfterExternBlock: false | ||
| BeforeCatch: false | ||
| BeforeElse: false | ||
| IndentBraces: false | ||
| SplitEmptyFunction: true | ||
| SplitEmptyRecord: true | ||
| SplitEmptyNamespace: true | ||
| BreakBeforeBinaryOperators: None | ||
| BreakBeforeBraces: Custom | ||
| BreakBeforeInheritanceComma: false | ||
| BreakBeforeTernaryOperators: false | ||
| BreakConstructorInitializersBeforeComma: false | ||
| BreakConstructorInitializers: BeforeComma | ||
| BreakAfterJavaFieldAnnotations: false | ||
| BreakStringLiterals: false | ||
| ColumnLimit: 120 | ||
|
||
| CommentPragmas: '^ IWYU pragma:' | ||
| CompactNamespaces: false | ||
| ConstructorInitializerAllOnOneLineOrOnePerLine: false | ||
| ConstructorInitializerIndentWidth: 8 | ||
| ContinuationIndentWidth: 8 | ||
| Cpp11BracedListStyle: false | ||
| DerivePointerAlignment: false | ||
| DisableFormat: false | ||
| ExperimentalAutoDetectBinPacking: false | ||
| FixNamespaceComments: false | ||
|
|
||
| # Taken from: | ||
| # git grep -h '^#define [^[:space:]]*for_each[^[:space:]]*(' include/ tools/ \ | ||
| # | sed "s,^#define \([^[:space:]]*for_each[^[:space:]]*\)(.*$, - '\1'," \ | ||
| # | LC_ALL=C sort -u | ||
| ForEachMacros: | ||
| - 'ARRAY_FOR_EACH' | ||
| - 'ARRAY_FOR_EACH_PTR' | ||
| - 'FOR_EACH' | ||
| - 'FOR_EACH_FIXED_ARG' | ||
| - 'FOR_EACH_IDX' | ||
| - 'FOR_EACH_IDX_FIXED_ARG' | ||
| - 'FOR_EACH_NONEMPTY_TERM' | ||
| - 'FOR_EACH_FIXED_ARG_NONEMPTY_TERM' | ||
| - 'RB_FOR_EACH' | ||
| - 'RB_FOR_EACH_CONTAINER' | ||
| - 'SYS_DLIST_FOR_EACH_CONTAINER' | ||
| - 'SYS_DLIST_FOR_EACH_CONTAINER_SAFE' | ||
| - 'SYS_DLIST_FOR_EACH_NODE' | ||
| - 'SYS_DLIST_FOR_EACH_NODE_SAFE' | ||
| - 'SYS_SEM_LOCK' | ||
| - 'SYS_SFLIST_FOR_EACH_CONTAINER' | ||
| - 'SYS_SFLIST_FOR_EACH_CONTAINER_SAFE' | ||
| - 'SYS_SFLIST_FOR_EACH_NODE' | ||
| - 'SYS_SFLIST_FOR_EACH_NODE_SAFE' | ||
| - 'SYS_SLIST_FOR_EACH_CONTAINER' | ||
| - 'SYS_SLIST_FOR_EACH_CONTAINER_SAFE' | ||
| - 'SYS_SLIST_FOR_EACH_NODE' | ||
| - 'SYS_SLIST_FOR_EACH_NODE_SAFE' | ||
| - '_WAIT_Q_FOR_EACH' | ||
| - '_WAIT_Q_FOR_EACH_SAFE' | ||
| - 'Z_FOR_EACH' | ||
| - 'Z_FOR_EACH_ENGINE' | ||
| - 'Z_FOR_EACH_EXEC' | ||
| - 'Z_FOR_EACH_FIXED_ARG' | ||
| - 'Z_FOR_EACH_FIXED_ARG_EXEC' | ||
| - 'Z_FOR_EACH_IDX' | ||
| - 'Z_FOR_EACH_IDX_EXEC' | ||
| - 'Z_FOR_EACH_IDX_FIXED_ARG' | ||
| - 'Z_FOR_EACH_IDX_FIXED_ARG_EXEC' | ||
| - 'Z_GENLIST_FOR_EACH_CONTAINER' | ||
| - 'Z_GENLIST_FOR_EACH_CONTAINER_SAFE' | ||
| - 'Z_GENLIST_FOR_EACH_NODE' | ||
| - 'Z_GENLIST_FOR_EACH_NODE_SAFE' | ||
| - 'STRUCT_SECTION_FOREACH' | ||
| - 'STRUCT_SECTION_FOREACH_ALTERNATE' | ||
| - 'TYPE_SECTION_FOREACH' | ||
| - 'K_SPINLOCK' | ||
| - 'COAP_RESOURCE_FOREACH' | ||
| - 'COAP_SERVICE_FOREACH' | ||
| - 'COAP_SERVICE_FOREACH_RESOURCE' | ||
| - 'HTTP_RESOURCE_FOREACH' | ||
| - 'HTTP_SERVER_CONTENT_TYPE_FOREACH' | ||
| - 'HTTP_SERVICE_FOREACH' | ||
| - 'HTTP_SERVICE_FOREACH_RESOURCE' | ||
| - 'I3C_BUS_FOR_EACH_I3CDEV' | ||
| - 'I3C_BUS_FOR_EACH_I2CDEV' | ||
| - 'MIN_HEAP_FOREACH' | ||
| - 'comp_dev_for_each_consumer' | ||
| - 'comp_dev_for_each_consumer_safe' | ||
| - 'comp_dev_for_each_producer' | ||
| - 'comp_dev_for_each_producer_safe' | ||
|
|
||
| IncludeBlocks: Preserve | ||
| IncludeCategories: | ||
| - Regex: '.*' | ||
| Priority: 1 | ||
| IncludeIsMainRegex: '(Test)?$' | ||
| IndentCaseLabels: false | ||
| IndentGotoLabels: false | ||
| IndentPPDirectives: None | ||
| IndentWidth: 4 | ||
| IndentWrappedFunctionNames: false | ||
| JavaScriptQuotes: Leave | ||
| JavaScriptWrapImports: true | ||
| KeepEmptyLinesAtTheStartOfBlocks: false | ||
| MacroBlockBegin: '' | ||
| MacroBlockEnd: '' | ||
| MaxEmptyLinesToKeep: 1 | ||
| NamespaceIndentation: None | ||
| ObjCBinPackProtocolList: Auto | ||
| ObjCBlockIndentWidth: 8 | ||
| ObjCSpaceAfterProperty: true | ||
| ObjCSpaceBeforeProtocolList: true | ||
|
|
||
| # Taken from git's rules | ||
| PenaltyBreakAssignment: 10 | ||
| PenaltyBreakBeforeFirstCallParameter: 30 | ||
| PenaltyBreakComment: 10 | ||
| PenaltyBreakFirstLessLess: 0 | ||
| PenaltyBreakString: 10 | ||
| PenaltyExcessCharacter: 100 | ||
| PenaltyReturnTypeOnItsOwnLine: 60 | ||
|
|
||
| PointerAlignment: Right | ||
| ReflowComments: false | ||
| SortIncludes: false | ||
| SortUsingDeclarations: false | ||
| SpaceAfterCStyleCast: false | ||
| SpaceAfterTemplateKeyword: true | ||
| SpaceBeforeAssignmentOperators: true | ||
| SpaceBeforeCtorInitializerColon: true | ||
| SpaceBeforeInheritanceColon: true | ||
| SpaceBeforeParens: ControlStatementsExceptForEachMacros | ||
| SpaceBeforeRangeBasedForLoopColon: true | ||
| SpaceInEmptyParentheses: false | ||
| SpacesBeforeTrailingComments: 1 | ||
| SpacesInAngles: false | ||
| SpacesInContainerLiterals: false | ||
| SpacesInCStyleCastParentheses: false | ||
| SpacesInParentheses: false | ||
| SpacesInSquareBrackets: false | ||
| Standard: Cpp03 | ||
| TabWidth: 4 | ||
| UseTab: Never | ||
| ... | ||
|
Comment on lines
+180
to
+181
|
||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,45 +14,9 @@ name: codestyle | |
| # yamllint disable-line rule:truthy | ||
| on: [pull_request, workflow_call, workflow_dispatch] | ||
|
|
||
| jobs: | ||
| checkpatch: | ||
| runs-on: ubuntu-22.04 | ||
|
|
||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| strictness: [null, --subjective] | ||
|
|
||
| env: | ||
| PR_NUM: ${{github.event.number}} | ||
| # TODO: reduce duplication with scripts/sof-*-commit-hook.sh | ||
| # thanks to either some .conf file or some wrapper script | ||
| CHK_CMD_OPTS: --ignore UNKNOWN_COMMIT_ID --codespell | ||
|
|
||
| steps: | ||
| # depth 2 so: | ||
| # ^1. we can show the Subject of the current target branch tip | ||
| # ^2. we reconnect/graft to the later fetch pull/1234/head, | ||
| - uses: actions/checkout@v4 | ||
| with: {fetch-depth: 2} | ||
|
|
||
| - name: install codespell | ||
| run: sudo apt-get -y install codespell && dpkg -L codespell | grep dict | ||
|
|
||
| # See shallowness issue https://github.com/thesofproject/linux/issues/2556 | ||
| - name: fetch PR commits | ||
| run: | | ||
| .github/workflows/shallowfetchPRcommits.sh \ | ||
| ${GITHUB_REPOSITORY} "$PR_NUM" | ||
| # show what we got | ||
| git --no-pager log --oneline --graph --decorate --max-count=50 | ||
|
|
||
| - name: checkpatch | ||
| env: | ||
| STRICTNESS: ${{ matrix.strictness }} | ||
| run: .github/workflows/checkpatch_list.sh ${CHK_CMD_OPTS} | ||
| ${STRICTNESS} < PR_SHAs.txt | ||
|
|
||
| jobs: | ||
| yamllint: | ||
| runs-on: ubuntu-latest | ||
|
Comment on lines
15
to
21
|
||
| steps: | ||
|
Comment on lines
14
to
22
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This clang-format configuration appears to be duplicated verbatim in two places (
.clang-formatandtools/rimage/.clang-format). Keeping identical configs in multiple locations is likely to diverge over time and create inconsistent formatting depending on where clang-format is invoked from. Consider consolidating to a single source of truth (preferably the repo root), or add an explicit comment/guardrail explaining whytools/rimage/needs its own copy and how it should be kept in sync.