Linux Test Project
 help / color / mirror / Atom feed
From: Andrea Cervesato via ltp <ltp@lists.linux.it>
To: "Petr Vorel" <pvorel@suse.cz>
Cc: Linux Test Project <ltp@lists.linux.it>
Subject: Re: [LTP] [PATCH] checkpatch: relax parenthesis style checks
Date: Wed, 22 Jul 2026 07:26:04 +0000	[thread overview]
Message-ID: <6a60708d.ba2bb225.b4339.1916@mx.google.com> (raw)
In-Reply-To: <20260722063259.GA821485@pevik>

Hi Petr,

> Hi Andrea, Cyril,
> 
> I found both rules useful (more readable and more consistent code). Can we put
> it back? Over the years you will recognise on the code of single test that it
> was written/modified by several people with a different styles. And that makes
> it less readable.
> 
> * PARENTHESIS_ALIGNMENT check enforces space behind 'while' or 'if'.
> i.e. instead of:
> 	while(tst_fzsync_run_b(&fzsync_pair)) {
> have:
> 	while (tst_fzsync_run_b(&fzsync_pair)) {
> 
> cve-2014-0196.c mixes 'while()' and 'while ()'. Is it that hard to be
> consistent on it?

im not sure that rule is checking for spaces after the statements. that
rule is avoiding stuff like:

	ruleset_fd = SAFE_LANDLOCK_CREATE_RULESET(ruleset_attr,
																						sizeof(struct tst_landlock_ruleset_attr_abi1), 0);

because parenthesis should allign the attributes of the functions. that
is super ugly when functions have really long names. Instead, this would
make much more sense:


	ruleset_fd = SAFE_LANDLOCK_CREATE_RULESET(ruleset_attr,
							     sizeof(struct tst_landlock_ruleset_attr_abi1), 0);

> 
> * OPEN_ENDED_LINE asks for not ending line with '(' or '['.
> i.e. instead of this:
> 	ruleset_fd = TST_EXP_FD_SILENT(
> 								   tst_syscall(__NR_landlock_create_ruleset, ruleset_attr,
> 						   sizeof(struct tst_landlock_ruleset_attr_abi1), 0));
> have this:
> 	ruleset_fd = TST_EXP_FD_SILENT(tst_syscall(__NR_landlock_create_ruleset, ruleset_attr,
> 						   sizeof(struct tst_landlock_ruleset_attr_abi1), 0));

you choose the right example, landlock testing suite has been updated to
match this rule and now it has stuff like:

	apply_landlock_fs_layer(ruleset_attr, sizeof(struct tst_landlock_ruleset_attr_abi1),
				path_beneath_attr, MNTPOINT, LANDLOCK_ACCESS_FS_IOCTL_DEV);

instead of

	apply_landlock_fs_layer(
				ruleset_attr,
				sizeof(struct tst_landlock_ruleset_attr_abi1),
				path_beneath_attr,
				MNTPOINT,
				LANDLOCK_ACCESS_FS_IOCTL_DEV
	);

that is more clear what are the functions attributes.

For the second one, maybe it's more like a personal preference, but the
first rule is actually generating a lot of weird code when functions and
attributes have long names, forcing to write long lines without staying
into the 80-100 chars.

--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com

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

  reply	other threads:[~2026-07-22  7:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-14  8:32 [LTP] [PATCH] checkpatch: relax parenthesis style checks Andrea Cervesato
2026-07-14  8:50 ` Cyril Hrubis
2026-07-22  6:32   ` Petr Vorel
2026-07-22  7:26     ` Andrea Cervesato via ltp [this message]
2026-07-22  8:04       ` Petr Vorel
2026-07-22 12:17         ` Andrea Cervesato via ltp
2026-07-24 11:31           ` Petr Vorel
2026-07-14 10:47 ` [LTP] " linuxtestproject.agent
2026-07-21 15:22 ` [LTP] [PATCH] " Andrea Cervesato via ltp

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=6a60708d.ba2bb225.b4339.1916@mx.google.com \
    --to=ltp@lists.linux.it \
    --cc=andrea.cervesato@suse.com \
    --cc=pvorel@suse.cz \
    /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