[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210721151416.30530-1-src.res@email.cn>
Date: Wed, 21 Jul 2021 23:14:16 +0800
From: Hu Haowen <src.res@...il.cn>
To: apw@...onical.com, joe@...ches.com
Cc: dwaipayanray1@...il.com, lukas.bulwahn@...il.com,
linux-kernel@...r.kernel.org, Hu Haowen <src.res@...il.cn>
Subject: [PATCH] checkpatch: add grammatical judgement for total output
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@...il.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
Powered by blists - more mailing lists