diff mbox series

[1/2] make check: b3: Use --strict when run checkpatch.pl

Message ID 20260105130359.647879-1-pvorel@suse.cz
State Accepted
Headers show
Series [1/2] make check: b3: Use --strict when run checkpatch.pl | expand

Checks

Context Check Description
ltpci/debian_stable_powerpc64le-linux-gnu-gcc_ppc64el success success
ltpci/debian_stable_aarch64-linux-gnu-gcc_arm64 success success
ltpci/debian_stable_s390x-linux-gnu-gcc_s390x success success
ltpci/ubuntu_jammy_gcc success success
ltpci/quay-io-centos-centos_stream9_gcc success success
ltpci/debian_stable_gcc success success
ltpci/ubuntu_bionic_gcc success success
ltpci/debian_oldstable_gcc success success
ltpci/fedora_latest_clang success success
ltpci/debian_testing_clang success success
ltpci/opensuse-leap_latest_gcc success success
ltpci/debian_testing_gcc success success
ltpci/alpine_latest_gcc success success
ltpci/debian_oldstable_clang success success
ltpci/debian_stable_gcc success success
ltpci/opensuse-archive_42-2_gcc success success

Commit Message

Petr Vorel Jan. 5, 2026, 1:03 p.m. UTC
The main motivation is to show typos on 'make check' which require --strict:

* TYPO_SPELLING
tst_cgroup.h:127: CHECK: 'libary' may be misspelled - perhaps 'library'?

Other checks included:

* LINE_SPACING
tst_test.h:174: CHECK: Please don't use multiple blank lines

* MACRO_ARG_REUSE:
tst_test.h:69: CHECK: Macro argument reuse 'ttype' - possible side-effects?
    #define tst_res(ttype, arg_fmt, ...) \
	({									\
		TST_RES_SUPPORTS_TCONF_TDEBUG_TFAIL_TINFO_TPASS_TWARN(\
			!((TTYPE_RESULT(ttype) ?: TCONF) & \
	...

* LONG_LINE:
tst_test.h:73: CHECK: line length of 105 exceeds 100 columns
=> enforced by --strict because we miss kernel fix from v6.11:
d6bb39519aafe ("checkpatch: really skip LONG_LINE_* when LONG_LINE is ignored")
(will be fixed by checkpatch.pl update in next commit).

Whitelist all other checks added by --strict.
Update also b4 config.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
NOTE: here are checked whitelisted. Do we want to add some of these?

Kind regards,
Petr

* LONG_LINE:
tst_test.h:73: CHECK: line length of 105 exceeds 100 columns

* SPACING
tst_test.c:1239: CHECK: spaces preferred around that '|' (ctx:VxV)

* MULTIPLE_ASSIGNMENTS
tst_test.c:1419: CHECK: multiple assignments should be avoided
TCID = tcid = get_tcid(argv);

* UNNECESSARY_PARENTHESES
tst_test.c:802: CHECK: Unnecessary parentheses around toptions[i].arg
*(toptions[i].arg) = optarg ? optarg : "";

* PARENTHESIS_ALIGNMENT
tst_test.c:1300: CHECK: Alignment should match open parenthesis
	mnt_data = limit_tmpfs_mount_size(fs->mnt_data,
					buf, sizeof(buf), tdev.fs_type);

* BRACES
tst_test.c:2069: CHECK: Blank lines aren't necessary before a close brace '}'
tst_test.c:1560: CHECK: Blank lines aren't necessary after an open brace '{'
	if (!tst_test->all_filesystems && count_fs_descs() <= 1) {

			if (!tst_fs_is_supported(tdev.fs_type))

* CONCATENATED_STRING
tst_test.c:200: CHECK: Concatenated strings should use spaces between elements
	tst_brk(TBROK, IPC_ENV_VAR" is not defined");

* PREFER_KERNEL_TYPES
tst_test.c:74: CHECK: Prefer kernel type 's32' over 'int32_t'
=> obviously kernel related

 .b4-config             | 4 ++--
 include/mk/env_post.mk | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

Comments

Andrea Cervesato Jan. 6, 2026, 10:48 a.m. UTC | #1
Hi!

On Mon Jan 5, 2026 at 2:03 PM CET, Petr Vorel wrote:
> The main motivation is to show typos on 'make check' which require --strict:
>
> * TYPO_SPELLING
> tst_cgroup.h:127: CHECK: 'libary' may be misspelled - perhaps 'library'?

+1

>
> Other checks included:
>
> * LINE_SPACING
> tst_test.h:174: CHECK: Please don't use multiple blank lines

+1

>
> * MACRO_ARG_REUSE:
> tst_test.h:69: CHECK: Macro argument reuse 'ttype' - possible side-effects?
>     #define tst_res(ttype, arg_fmt, ...) \
> 	({									\
> 		TST_RES_SUPPORTS_TCONF_TDEBUG_TFAIL_TINFO_TPASS_TWARN(\
> 			!((TTYPE_RESULT(ttype) ?: TCONF) & \
> 	...

+1

>
> * LONG_LINE:
> tst_test.h:73: CHECK: line length of 105 exceeds 100 columns
> => enforced by --strict because we miss kernel fix from v6.11:
> d6bb39519aafe ("checkpatch: really skip LONG_LINE_* when LONG_LINE is ignored")
> (will be fixed by checkpatch.pl update in next commit).

Tricky, I would leave this choice to reviewers.

>
> Whitelist all other checks added by --strict.
> Update also b4 config.
>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
> NOTE: here are checked whitelisted. Do we want to add some of these?
>
> Kind regards,
> Petr
>
> * LONG_LINE:
> tst_test.h:73: CHECK: line length of 105 exceeds 100 columns

Like above.

>
> * SPACING
> tst_test.c:1239: CHECK: spaces preferred around that '|' (ctx:VxV)

+1

>
> * MULTIPLE_ASSIGNMENTS
> tst_test.c:1419: CHECK: multiple assignments should be avoided
> TCID = tcid = get_tcid(argv);

+1

>
> * UNNECESSARY_PARENTHESES
> tst_test.c:802: CHECK: Unnecessary parentheses around toptions[i].arg
> *(toptions[i].arg) = optarg ? optarg : "";

Also tricky, sometimes parentheses are useful to clarify certain
concepts.

>
> * PARENTHESIS_ALIGNMENT
> tst_test.c:1300: CHECK: Alignment should match open parenthesis
> 	mnt_data = limit_tmpfs_mount_size(fs->mnt_data,
> 					buf, sizeof(buf), tdev.fs_type);
>

It really depends, for me it's too strick.

> * BRACES
> tst_test.c:2069: CHECK: Blank lines aren't necessary before a close brace '}'
> tst_test.c:1560: CHECK: Blank lines aren't necessary after an open brace '{'
> 	if (!tst_test->all_filesystems && count_fs_descs() <= 1) {
>
> 			if (!tst_fs_is_supported(tdev.fs_type))

+1

>
> * CONCATENATED_STRING
> tst_test.c:200: CHECK: Concatenated strings should use spaces between elements
> 	tst_brk(TBROK, IPC_ENV_VAR" is not defined");

+1

>
> * PREFER_KERNEL_TYPES
> tst_test.c:74: CHECK: Prefer kernel type 's32' over 'int32_t'
> => obviously kernel related

This is kernel related and I would use stdint.h definitions instead,
otherwise we need to import linux headers to use types and we don't
need that.

>
>  .b4-config             | 4 ++--
>  include/mk/env_post.mk | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/.b4-config b/.b4-config
> index 36aa15c38f..5ff045b55b 100644
> --- a/.b4-config
> +++ b/.b4-config
> @@ -4,6 +4,6 @@
>      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 --ignore CONST_STRUCT,VOLATILE,SPLIT_STRING,FILE_PATH_CHANGES
> -    am-perpatch-check-cmd = ./scripts/checkpatch.pl -q --terse --no-summary --mailback --no-tree --ignore CONST_STRUCT,VOLATILE,SPLIT_STRING,FILE_PATH_CHANGES
> +    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,BRACES,CONCATENATED_STRING
> +    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,BRACES,CONCATENATED_STRING
>  
> diff --git a/include/mk/env_post.mk b/include/mk/env_post.mk
> index ab31da73af..947151457b 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 --ignore CONST_STRUCT,VOLATILE,SPLIT_STRING,FILE_PATH_CHANGES
> +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,BRACES,CONCATENATED_STRING
>  SHELL_CHECK			?= $(abs_top_srcdir)/scripts/checkbashisms.pl --force --extra
>  SHELL_CHECK_TARGETS		?= $(addprefix check-,$(notdir $(sort $(wildcard $(abs_srcdir)/*.sh))))
>  


Thanks for checking this.
Andrea Cervesato Jan. 6, 2026, 10:49 a.m. UTC | #2
Also, please change the commit title, because it's b4, not b3.
Petr Vorel Jan. 6, 2026, 12:02 p.m. UTC | #3
> Also, please change the commit title, because it's b4, not b3.

Lol, I guess accidental ctrl+x press in vim.

Kind regards,
Petr
Petr Vorel Feb. 2, 2026, 11:34 a.m. UTC | #4
Hi Andrea,

> Also, please change the commit title, because it's b4, not b3.

Patchset merged, with fixed the commit title.
Thanks!

Kind regards,
Petr
diff mbox series

Patch

diff --git a/.b4-config b/.b4-config
index 36aa15c38f..5ff045b55b 100644
--- a/.b4-config
+++ b/.b4-config
@@ -4,6 +4,6 @@ 
     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 --ignore CONST_STRUCT,VOLATILE,SPLIT_STRING,FILE_PATH_CHANGES
-    am-perpatch-check-cmd = ./scripts/checkpatch.pl -q --terse --no-summary --mailback --no-tree --ignore CONST_STRUCT,VOLATILE,SPLIT_STRING,FILE_PATH_CHANGES
+    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,BRACES,CONCATENATED_STRING
+    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,BRACES,CONCATENATED_STRING
 
diff --git a/include/mk/env_post.mk b/include/mk/env_post.mk
index ab31da73af..947151457b 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 --ignore CONST_STRUCT,VOLATILE,SPLIT_STRING,FILE_PATH_CHANGES
+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,BRACES,CONCATENATED_STRING
 SHELL_CHECK			?= $(abs_top_srcdir)/scripts/checkbashisms.pl --force --extra
 SHELL_CHECK_TARGETS		?= $(addprefix check-,$(notdir $(sort $(wildcard $(abs_srcdir)/*.sh))))