[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4e7d00e8e39e5394c601e2a69038e6349b7b91e7.camel@perches.com>
Date: Fri, 14 Feb 2025 21:24:01 -0800
From: Joe Perches <joe@...ches.com>
To: Guilherme Giacomo Simoes <trintaeoitogc@...il.com>,
a.hindborg@...nel.org, alex.gaynor@...il.com, aliceryhl@...gle.com,
apw@...onical.com, arnd@...db.de, aswinunni01@...il.com, axboe@...nel.dk,
benno.lossin@...ton.me, bhelgaas@...gle.com, bjorn3_gh@...tonmail.com,
boqun.feng@...il.com, dakr@...nel.org, dwaipayanray1@...il.com,
ethan.twardy@...il.com, fujita.tomonori@...il.com, gary@...yguo.net,
gregkh@...uxfoundation.org, lukas.bulwahn@...il.com, ojeda@...nel.org,
pbonzini@...hat.com, tmgross@...ch.edu, walmeida@...rosoft.com
Cc: rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH V2 2/2] checkpatch: throw error in malformed arrays
On Fri, 2025-02-14 at 15:45 -0300, Guilherme Giacomo Simoes wrote:
> In module! macro, some fields have a string array type, and we need a
> check for guarantee a good formatation.
> Check if the current line contains one of these keys that must be a
> string array and if so, make a regex for check if contains more than one
> value in array, if yes, the array should be in vertical. If array have
> only one value, so the array can be in the same line.
>
> Signed-off-by: Guilherme Giacomo Simoes <trintaeoitogc@...il.com>
[]
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -3567,6 +3570,46 @@ sub process {
[]
> +
> + if ($add_line && $key) {
> + my $herevet = "\n$here\n" . cat_vet($rawline) . "\n";
Please look at the other checkpatch uses of $herevet
$herevet does not begin with '\n'
> +
> + my $counter = () = $line =~ /"/g;
> + my $more_than_one = $counter > 2;
> + if ($more_than_one) {
> + WARN("ARRAY_MODULE_MACRO",
> + "Prefere one value per line$herevet");
Prefer not Prefere
Align to open parenthesis
So this should be
WARN("ARRAY_MODULE_MACRO"
"Prefer one value per line\n" . $herevet);
etc...
Powered by blists - more mailing lists