All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hu Haowen <src.res@email.cn>
To: apw@canonical.com, joe@perches.com
Cc: dwaipayanray1@gmail.com, lukas.bulwahn@gmail.com,
	linux-kernel@vger.kernel.org, Hu Haowen <src.res@email.cn>
Subject: [PATCH] checkpatch: add grammatical judgement for total output
Date: Wed, 21 Jul 2021 23:14:16 +0800	[thread overview]
Message-ID: <20210721151416.30530-1-src.res@email.cn> (raw)

There lacked a English grammatical identification within the final
output of checkpatch.pl such as the following:

    total: 1 errors, 11 warnings, 4094 lines checked
                  ^

Which violated the rule about the usage of the singular form and the
plural form. Hence fix the issue up and make it output the proper
sentence.

Signed-off-by: Hu Haowen <src.res@email.cn>
---
 scripts/checkpatch.pl | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 461d4221e4a4..eec96ed95262 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -7439,9 +7439,14 @@ sub process {
 	print report_dump();
 	if ($summary && !($clean == 1 && $quiet == 1)) {
 		print "$filename " if ($summary_file);
-		print "total: $cnt_error errors, $cnt_warn warnings, " .
-			(($check)? "$cnt_chk checks, " : "") .
-			"$cnt_lines lines checked\n";
+		my $errors_str = ($cnt_error == 1) ? "error" : "errors";
+		my $warnings_str = ($cnt_warn == 1) ? "warning" : "warnings";
+		my $checks_str = ($cnt_chk == 1) ? "check" : "checks";
+		my $lines_str = ($cnt_lines == 1) ? "line" : "lines";
+		print "total: $cnt_error $errors_str, " .
+			"$cnt_warn $warnings_str, " .
+			(($check)? "$cnt_chk $checks_str, " : "") .
+			"$cnt_lines $lines_str checked\n";
 	}
 
 	if ($quiet == 0) {
-- 
2.25.1


             reply	other threads:[~2021-07-21 15:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-21 15:14 Hu Haowen [this message]
2021-07-21 16:03 ` [PATCH] checkpatch: add grammatical judgement for total output Joe Perches
2021-07-22 10:04   ` Hu Haowen
2021-07-22 17:01     ` Joe Perches

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=20210721151416.30530-1-src.res@email.cn \
    --to=src.res@email.cn \
    --cc=apw@canonical.com \
    --cc=dwaipayanray1@gmail.com \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukas.bulwahn@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.