[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <8f8c79c5f1c5508defdd4a4c020c2c8e60b95afb.camel@perches.com>
Date: Sun, 09 Mar 2025 23:36:20 -0700
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,
charmitro@...teo.net
Cc: rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH V9 2/2] checkpatch: check format of Vec<String> in
modules
On Sun, 2025-03-09 at 14:57 -0300, Guilherme Giacomo Simoes wrote:
> Implement a check to ensure that the author, firmware, and alias fields
> of the module! macro are properly formatted.
>
> * If the array contains more than one value, enforce vertical
> formatting.
> * If the array contains only one value, it may be formatted on a single
> line
What happens if the patch contains more than one module?
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> +# check if the field is about author, firmware or alias from module! macro and find malformed arrays
> + my $inline = 0;
> + my $key = "";
> + my $add_line = $line =~ /^\+/;
> +
> + if ($line =~ /\b(authors|alias|firmware)\s*:\s*\[/) {
?
> + if ($expected_spaces && $spaces) {
> + if (length($spaces) != length($expected_spaces)) {
spaces contains both spaces and tabs.
Why not test the strings rather than the length?
Otherwise tab-space is the same length as space-tab.
> + WARN("ARRAY_MODULE_MACRO",
> + "Prefer aligned parameters\n" . $herevet_space_add);
Alignment to open parenthesis please.
Why is herevet_space_add more useful than herevet?
Powered by blists - more mailing lists