Skip to contentSkip to conversation

checkpatch: simplify the output of --list-types

PATCH In review Jean Delvare 2 participants 3 messages Sep 4, 2017 – Sep 5, 2017 Checkpatch

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 checkpatch: simplify the output of --list-types

Drop the header and numbering of types. This format was confusing as it suggested one could pass the number instead of the type name, however it did not actually work, and numbering wasn't stable anyway.

Cc Andy Whitcroft <[email protected]>
Cc Joe Perches <[email protected]>
---
 scripts/checkpatch.pl |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
scripts/checkpatch.pl +1 -4
@@ -134,8 +134,6 @@ sub uniq {
 sub list_types {
 	my ($exitcode) = @_;
 
-	my $count = 0;
-
 	local $/ = undef;
 
 	open(my $script, '<', abs_path($P)) or
@@ -150,9 +148,8 @@ sub list_types {
 		push (@types, $_);
 	}
 	@types = sort(uniq(@types));
-	print("#\tMessage type\n\n");
 	foreach my $type (@types) {
-		print(++$count . "\t" . $type . "\n");
+		print "$type\n";
 	}
 
 	exit($exitcode);
Signature · 2 lines
Jean Delvare
SUSE L3 Support
maintainer
#1 lore raw
Quoted 3 lines · Jean Delvare

Drop the header and numbering of types. This format was confusing as it suggested one could pass the number instead of the type name, however it did not actually work, and numbering wasn't stable anyway.

<shrug> If it makes you happy.

I suppose a bigger improvement would be to detail
the purpose of each type.

Most are fairly obvious, some like MEMSET are
a bit obscure.

Another defect:

The list also includes types that are commented out.

#2 lore raw
Quoted 9 lines · Joe Perches
Quoted 3 lines · Jean Delvare

Drop the header and numbering of types. This format was confusing as it suggested one could pass the number instead of the type name, however it did not actually work, and numbering wasn't stable anyway.

<shrug> If it makes you happy.

I suppose a bigger improvement would be to detail
the purpose of each type.

That would be great indeed, however this would require a completely different approach, as I can't think of a way to automatically extract this information by just parsing the script.

Quoted 6 lines

Most are fairly obvious, some like MEMSET are
a bit obscure.

Another defect:

The list also includes types that are commented out.

This could be considered a feature: if they were not listed, the user would have no idea that they can be commented out.

OTOH I'm not sure why some tests are commented out in the first place, it doesn't make much sense to me. Either they serve a purpose and they should be enabled, or there is some kind of issue with them and they should be either fixed or deleted altogether.

Signature · 2 lines
Jean Delvare
SUSE L3 Support