Linux Test Project
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Cc: "Ricardo B. Marlière" <rbm@suse.com>
Subject: [LTP] [PATCH 3/4] Add .checkpatch.conf for checkpatch.pl
Date: Fri, 24 Apr 2026 11:39:18 +0200	[thread overview]
Message-ID: <20260424093919.500059-4-pvorel@suse.cz> (raw)
In-Reply-To: <20260424093919.500059-1-pvorel@suse.cz>

This helps to remove duplicity because checkpatch.pl is used in 'make
check' and in b4 config.

b4 uses some specific flags --mailback --showfile.

For make check use $CHECKPATCH_CONFIG_DIR (new feature from previous
commit) to pass config file in the root directory. b4 is already run
from the root directory therefore it does not need it (script uses
default search path: '.:$HOME:.scripts'.

For some reason CAMELCASE check now creates a file with camel case variables:
.checkpatch-camelcase.git.70caa71934, add it to the top level .gitignore.

Document at least some options in .checkpatch.conf.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
There should not be any functional change other that camelcase file.
Cc b4 users :)

 .b4-config             |  5 +++--
 .checkpatch.conf       | 13 +++++++++++++
 .gitignore             |  3 +++
 include/mk/env_post.mk |  2 +-
 4 files changed, 20 insertions(+), 3 deletions(-)
 create mode 100644 .checkpatch.conf

diff --git a/.b4-config b/.b4-config
index da805a8a6b..ff3199624c 100644
--- a/.b4-config
+++ b/.b4-config
@@ -4,6 +4,7 @@
     send-series-to = Linux Test Project <ltp@lists.linux.it>
     pw-url = https://patchwork.ozlabs.org/
     pw-project = ltp
-    prep-perpatch-check-cmd = ./scripts/checkpatch.pl -q --terse --no-summary --mailback --showfile --no-tree --strict --ignore CONST_STRUCT,VOLATILE,SPLIT_STRING,FILE_PATH_CHANGES,PREFER_KERNEL_TYPES,LONG_LINE,MACRO_ARG_REUSE,SPACING,MULTIPLE_ASSIGNMENTS,UNNECESSARY_PARENTHESES,PARENTHESIS_ALIGNMENT,CONCATENATED_STRING,STRCPY,STRLCPY,STRNCPY
-    am-perpatch-check-cmd = ./scripts/checkpatch.pl -q --terse --no-summary --mailback --no-tree --strict --ignore CONST_STRUCT,VOLATILE,SPLIT_STRING,FILE_PATH_CHANGES,PREFER_KERNEL_TYPES,LONG_LINE,MACRO_ARG_REUSE,SPACING,MULTIPLE_ASSIGNMENTS,UNNECESSARY_PARENTHESES,PARENTHESIS_ALIGNMENT,CONCATENATED_STRING,STRCPY,STRLCPY,STRNCPY
 
+    # other checkpatch.pl options from .checkpatch.conf are used
+    prep-perpatch-check-cmd = ./scripts/checkpatch.pl -q --mailback --showfile
+    am-perpatch-check-cmd = ./scripts/checkpatch.pl -q --mailback
diff --git a/.checkpatch.conf b/.checkpatch.conf
new file mode 100644
index 0000000000..20b92aaca9
--- /dev/null
+++ b/.checkpatch.conf
@@ -0,0 +1,13 @@
+# Not Linux, so don't expect a Linux tree.
+--no-tree
+
+-f --terse --no-summary
+
+# enable more tests
+--strict
+
+# kernel specific
+--ignore PREFER_KERNEL_TYPES,STRCPY,STRLCPY,STRNCPY
+
+# TODO: document reason
+--ignore CONST_STRUCT,VOLATILE,SPLIT_STRING,FILE_PATH_CHANGES,LONG_LINE,MACRO_ARG_REUSE,SPACING,MULTIPLE_ASSIGNMENTS,UNNECESSARY_PARENTHESES,PARENTHESIS_ALIGNMENT,CONCATENATED_STRING
diff --git a/.gitignore b/.gitignore
index 3fdfeaba03..f034ca1647 100644
--- a/.gitignore
+++ b/.gitignore
@@ -63,3 +63,6 @@ logfile.*
 
 compile_flags.txt
 compile_commands.json
+
+# added by scripts/checkpatch.pl
+.checkpatch-camelcase.*
diff --git a/include/mk/env_post.mk b/include/mk/env_post.mk
index dcb0bbc6c5..1b0d3a2a8e 100644
--- a/include/mk/env_post.mk
+++ b/include/mk/env_post.mk
@@ -73,7 +73,7 @@ CHECK_TARGETS			?= $(addprefix check-,$(notdir $(patsubst %.c,%,$(sort $(wildcar
 CHECK_TARGETS			:= $(filter-out $(addprefix check-, $(FILTER_OUT_MAKE_TARGETS)), $(CHECK_TARGETS))
 CHECK_HEADER_TARGETS		?= $(addprefix check-,$(notdir $(sort $(wildcard $(abs_srcdir)/*.h))))
 CHECK				?= $(abs_top_srcdir)/tools/sparse/sparse-ltp
-CHECK_NOFLAGS			?= $(abs_top_srcdir)/scripts/checkpatch.pl -f --no-tree --terse --no-summary --strict --ignore CONST_STRUCT,VOLATILE,SPLIT_STRING,FILE_PATH_CHANGES,PREFER_KERNEL_TYPES,LONG_LINE,MACRO_ARG_REUSE,SPACING,MULTIPLE_ASSIGNMENTS,UNNECESSARY_PARENTHESES,PARENTHESIS_ALIGNMENT,CONCATENATED_STRING,STRCPY,STRLCPY,STRNCPY
+CHECK_NOFLAGS			?= CHECKPATCH_CONFIG_DIR="$(abs_top_srcdir)" $(abs_top_srcdir)/scripts/checkpatch.pl -f
 SHELL_CHECK			?= $(abs_top_srcdir)/scripts/checkbashisms.pl --force --extra
 SHELL_CHECK_TARGETS		?= $(addprefix check-,$(notdir $(sort $(wildcard $(abs_srcdir)/*.sh))))
 
-- 
2.53.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  parent reply	other threads:[~2026-04-24  9:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-24  9:39 [LTP] [PATCH 0/4] checkpatch: Add .checkpatch.conf Petr Vorel
2026-04-24  9:39 ` [LTP] [PATCH 1/4] Update spellings to next-20260423 Petr Vorel
2026-04-24 10:25   ` [LTP] " linuxtestproject.agent
2026-04-24 11:36     ` Petr Vorel
2026-04-28  7:22       ` Andrea Cervesato via ltp
2026-04-24  9:39 ` [LTP] [PATCH 2/4] checkpatch: Update to use new features Petr Vorel
2026-04-24  9:39 ` Petr Vorel [this message]
2026-04-24  9:39 ` [LTP] [PATCH 4/4] checkpatch: Enable more checks, disable ENOSYS Petr Vorel
2026-04-24 11:57 ` [LTP] [PATCH 0/4] checkpatch: Add .checkpatch.conf Ricardo B. Marlière via ltp
2026-04-29  8:06   ` Petr Vorel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260424093919.500059-4-pvorel@suse.cz \
    --to=pvorel@suse.cz \
    --cc=ltp@lists.linux.it \
    --cc=rbm@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox