Skip to content

checkpatch: introduce .checkpatch.conf#117

Draft
mshinjo wants to merge 9 commits intomainfrom
fix-checkpatch
Draft

checkpatch: introduce .checkpatch.conf#117
mshinjo wants to merge 9 commits intomainfrom
fix-checkpatch

Conversation

@mshinjo
Copy link
Member

@mshinjo mshinjo commented Sep 14, 2025

This PR introduces .checkpatch.conf, which was obtained from the upstream Zephyr Project v4.2.0 with a modification of adding --strict.
https://raw.githubusercontent.com/zephyrproject-rtos/zephyr/refs/tags/v4.2.0/.checkpatch.conf

Although this .checkpatch.conf has no SPDX ID, there is an Apache-2.0 license at the root of the upstream Zephyr Project Git repository.
Therefore, .checkpatch.conf is distributed under Apache-2.0 and is being redistributed here under the same license.

This PR also aims to address #116.

@mshinjo mshinjo added the DevOps label Sep 14, 2025
@mshinjo mshinjo force-pushed the fix-checkpatch branch 2 times, most recently from 66a0dda to 51ccd81 Compare September 28, 2025 22:16
@mshinjo mshinjo force-pushed the fix-checkpatch branch 2 times, most recently from 48907a2 to 5c89f46 Compare October 3, 2025 03:36
@mshinjo mshinjo force-pushed the fix-checkpatch branch 6 times, most recently from 358889e to f32440d Compare October 13, 2025 22:04
@mshinjo mshinjo force-pushed the fix-checkpatch branch 3 times, most recently from cb7ed4e to 42f706d Compare January 7, 2026 22:51
Update checkpatch.pl to v6.18.3 from upstream kernel.org [1].

[1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/plain/scripts/checkpatch.pl?h=v6.18.3

Signed-off-by: Mirai SHINJO <oss@mshinjo.com>
This patch introduces .checkpatch.conf, which was obtained from
the upstream Zephyr Project v4.2.0 [1].

Although this .checkpatch.conf has no SPDX ID, there is an Apache-2.0
license at the root of the upstream Zephyr Project Git repository.
Therefore, .checkpatch.conf is distributed under Apache-2.0 and
is being redistributed here under the same license.

[1] https://raw.githubusercontent.com/zephyrproject-rtos/zephyr/refs/tags/v4.2.0/.checkpatch.conf

Signed-off-by: Mirai SHINJO <oss@mshinjo.com>
Commit 8750afb introduced a change that ignores UNNECESSARY_ELSE in
this Git repository.
Hence, configure .checkpatch.conf to ignore UNNECESSARY_ELSE.

Signed-off-by: Mirai SHINJO <oss@mshinjo.com>
Commit 77d42a7 introduced a change that ignores NEW_TYPEDEFS in
this Git repository.
Hence, configure .checkpatch.conf to ignore NEW_TYPEDEFS.

Signed-off-by: Mirai SHINJO <oss@mshinjo.com>
To report '--max-line-length' violation with '--file',
'--strict' is required.

./scripts/checkpatch.pl --help | grep -A 2 max-line-length
  --max-line-length=n        set the maximum line length, (default 100)
                             if exceeded, warn on patches
                             requires --strict for use with --file

Signed-off-by: Mirai SHINJO <oss@mshinjo.com>
Instead of hard coding checkpatch configuration, use .checkpatch.conf.

Signed-off-by: Mirai SHINJO <oss@mshinjo.com>
This commit replaces all instances of C99 style comments '//' with
C89 style comments '/* */'.

This resolves all instances of "ERROR:C99_COMMENTS" from checkpatch.

Signed-off-by: Mirai SHINJO <oss@mshinjo.com>
checkpatch reports the following:
"WARNING:BRACES:
   braces {} are not necessary for single statement blocks"

However, the upstream Zephyr coding guidelines [1] states the following:
"Add braces to every if, else, do, while, for and switch body, even for
single-line code blocks"

Therefore, ignore 'BRACES'.

[1] https://docs.zephyrproject.org/4.2.0/contribute/style/code.html

Signed-off-by: Mirai SHINJO <oss@mshinjo.com>
@mshinjo mshinjo force-pushed the fix-checkpatch branch 2 times, most recently from 58ebf1c to b25156e Compare January 7, 2026 23:28
This patch removes CHECK:LINE_SPACING reported by checkpatch.pl.

Signed-off-by: Mirai SHINJO <oss@mshinjo.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants