lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 01 Jun 2015 11:02:42 -0700
From:	Joe Perches <joe@...ches.com>
To:	Petr Mladek <pmladek@...e.cz>
Cc:	Andy Whitcroft <apw@...onical.com>, linux-kernel@...r.kernel.org,
	Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH] checkpatch: Make the output better readable

On Mon, 2015-06-01 at 16:25 +0200, Petr Mladek wrote:
> I always have troubles to parse checkpatch.pl output when I check
> the whole patchset. It is hard to say which messages belongs to
> what patch.
> 
> This patch does few small changes to make the output look better
> for me:

As git and other utilities now use color by default, what do
you think about adding color for various message types?

And colorize only to the terminal, not any redirected output.

Maybe something like:

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index c8032a0..12c43c6 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -9,6 +9,7 @@ use strict;
 use POSIX;
 use File::Basename;
 use Cwd 'abs_path';
+use Term::ANSIColor qw(:constants);
 
 my $P = $0;
 my $D = dirname(abs_path($P));
@@ -1649,10 +1650,24 @@ sub report {
 		return 0;
 	}
 	my $line;
+	my $cprefix = $prefix;
+	my $clevel = $level;
+	my $ctype = $type;
+	if (-t STDOUT) {
+		$cprefix = GREEN . $prefix . RESET;
+		if ($level eq "ERROR") {
+			$clevel = RED . $level . RESET;
+		} elsif ($level eq "WARNING") {
+			$clevel = YELLOW . $level . RESET;
+		} else {
+			$clevel = GREEN . $level . RESET;
+		}
+		$ctype = GREEN . $type . RESET;
+	}
 	if ($show_types) {
-		$line = "$prefix$level:$type: $msg\n";
+		$line = "$cprefix$clevel:$ctype: $msg\n";
 	} else {
-		$line = "$prefix$level: $msg\n";
+		$line = "$cprefix$clevel: $msg\n";
 	}
 	$line = (split('\n', $line))[0] . "\n" if ($terse);
 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ