Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
121 changes: 0 additions & 121 deletions .clang-format

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/SPDX-README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Read this section if there are some SPDX warnings above.
Adding correct SPDX headers to new files can be tricky because:
Pleasing checkpatch is hard when adding new files because:

- a different SPDX style is expected for .c versus .h files.
- checkpatch requests a different SPDX style for .c versus .h files.
This is because some .h files are included in linker scripts or
assembly code.
- Some SOF reviewers reject C99 comments starting with //
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/checkpatch_list.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/sh
# SPDX-License-Identifier: BSD-3-Clause

set -e

# The purpose of this script is not to stop on the first checkpatch
# failure and report at the end instead.
#
# Sample invocation:
# $0 --codespell --strict < PR_SHAs.txt
main()
{
local failures=0
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checkpatch_list.sh is declared with #!/bin/sh but uses local inside main(), which is not POSIX and will fail on Ubuntu where /bin/sh is dash. Either switch the shebang to bash or remove local usage to keep the script portable.

Suggested change
local failures=0
failures=0

Copilot uses AI. Check for mistakes.
while read -r sha ; do
printf '\n -------------- \n\n'
./scripts/checkpatch.pl $@ -g $sha || failures=$((failures+1))
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Arguments are expanded unquoted in the checkpatch invocation ($@ and $sha). This can lead to word-splitting/globbing issues; use quoted expansions (e.g. preserve each arg) and quote the SHA variable.

Suggested change
./scripts/checkpatch.pl $@ -g $sha || failures=$((failures+1))
./scripts/checkpatch.pl "$@" -g "$sha" || failures=$((failures+1))

Copilot uses AI. Check for mistakes.
done
printf '\n -------------- \n\n'

if [ $failures -ne 0 ]; then
cat .github/workflows/SPDX-README.md
fi

return $failures
Comment on lines +22 to +24
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script returns the number of failures as the process exit status. Shell exit codes are limited to 0–255, so large PRs could overflow/wrap and potentially misreport success/failure. Consider exiting with 1 when any failure occurred (and 0 otherwise), while still printing the full summary.

Suggested change
fi
return $failures
return 1
fi
return 0

Copilot uses AI. Check for mistakes.
}

main "$@"
38 changes: 38 additions & 0 deletions .github/workflows/codestyle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,44 @@ permissions:
contents: read

jobs:
checkpatch:
runs-on: ubuntu-24.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

yamllint:
runs-on: ubuntu-latest
steps:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ tools/test/audio/reports/*
tools/test/audio/zeros_in.raw

__pycache__
.checkpatch-camelcase.git.*

build*/

Expand Down
Loading
Loading