From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756014AbbFBJ0x (ORCPT ); Tue, 2 Jun 2015 05:26:53 -0400 Received: from cantor2.suse.de ([195.135.220.15]:53647 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752585AbbFBJ0p (ORCPT ); Tue, 2 Jun 2015 05:26:45 -0400 Date: Tue, 2 Jun 2015 11:26:43 +0200 From: Petr Mladek To: Joe Perches Cc: Andy Whitcroft , linux-kernel@vger.kernel.org, Andrew Morton Subject: Re: [PATCH] checkpatch: Make the output better readable Message-ID: <20150602092643.GK3135@pathway.suse.cz> References: <1433168737-17009-1-git-send-email-pmladek@suse.cz> <1433181762.4861.29.camel@perches.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1433181762.4861.29.camel@perches.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 2015-06-01 11:02:42, Joe Perches wrote: > 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. JFYI, the output with this patch looks fine to me but to be honest I do not mind much about it. I sent a patch that helped me a lot with parsing. If it is accepted in some form, it would be great. I am sure that more improvements are possible. But all this is matter of personal taste. I am afraid that this theme is prone for bikeshedding and I do not want to get involved if possible :-) Best Regards, Petr > 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); > > >