linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] checkpatch: add grammatical judgement for total output
@ 2021-07-21 15:14 Hu Haowen
  2021-07-21 16:03 ` Joe Perches
  0 siblings, 1 reply; 4+ messages in thread
From: Hu Haowen @ 2021-07-21 15:14 UTC (permalink / raw)
  To: apw, joe; +Cc: dwaipayanray1, lukas.bulwahn, linux-kernel, Hu Haowen

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] checkpatch: add grammatical judgement for total output
  2021-07-21 15:14 [PATCH] checkpatch: add grammatical judgement for total output Hu Haowen
@ 2021-07-21 16:03 ` Joe Perches
  2021-07-22 10:04   ` Hu Haowen
  0 siblings, 1 reply; 4+ messages in thread
From: Joe Perches @ 2021-07-21 16:03 UTC (permalink / raw)
  To: Hu Haowen, apw; +Cc: dwaipayanray1, lukas.bulwahn, linux-kernel

On Wed, 2021-07-21 at 23:14 +0800, Hu Haowen wrote:
> 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.

NAK

I appreciate the desire for precision but I don't want to require
any automated downstream user of checkpatch to be changed.

I think users understand the output even though it may not be
grammatically correct in some cases.

> diff --git 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) {



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] checkpatch: add grammatical judgement for total output
  2021-07-21 16:03 ` Joe Perches
@ 2021-07-22 10:04   ` Hu Haowen
  2021-07-22 17:01     ` Joe Perches
  0 siblings, 1 reply; 4+ messages in thread
From: Hu Haowen @ 2021-07-22 10:04 UTC (permalink / raw)
  To: Joe Perches, apw; +Cc: dwaipayanray1, lukas.bulwahn, linux-kernel


On 2021/7/22 上午12:03, Joe Perches wrote:
> On Wed, 2021-07-21 at 23:14 +0800, Hu Haowen wrote:
>> 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.
> NAK
>
> I appreciate the desire for precision but I don't want to require
> any automated downstream user of checkpatch to be changed.
>
> I think users understand the output even though it may not be
> grammatically correct in some cases.


How about another modification, which turns "errors" into "error(s)"?
In this case not only did the meaning convey but automated users won't
be confused toward their automatic programs.


>> diff --git 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) {


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] checkpatch: add grammatical judgement for total output
  2021-07-22 10:04   ` Hu Haowen
@ 2021-07-22 17:01     ` Joe Perches
  0 siblings, 0 replies; 4+ messages in thread
From: Joe Perches @ 2021-07-22 17:01 UTC (permalink / raw)
  To: Hu Haowen, apw; +Cc: dwaipayanray1, lukas.bulwahn, linux-kernel

On Thu, 2021-07-22 at 18:04 +0800, Hu Haowen wrote:
> On 2021/7/22 上午12:03, Joe Perches wrote:
> > On Wed, 2021-07-21 at 23:14 +0800, Hu Haowen wrote:
> > > 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.
> > NAK
> > 
> > I appreciate the desire for precision but I don't want to require
> > any automated downstream user of checkpatch to be changed.
> > 
> > I think users understand the output even though it may not be
> > grammatically correct in some cases.
> 
> 
> How about another modification, which turns "errors" into "error(s)"?
> In this case not only did the meaning convey but automated users won't
> be confused toward their automatic programs.

I still think this doesn't need to be changed.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-07-22 17:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-21 15:14 [PATCH] checkpatch: add grammatical judgement for total output Hu Haowen
2021-07-21 16:03 ` Joe Perches
2021-07-22 10:04   ` Hu Haowen
2021-07-22 17:01     ` Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).