lkml.org 
[lkml]   [2015]   [Jun]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [PATCH] checkpatch: Make the output better readable
    From
    Date
    (adding back cc's)

    On Mon, 2015-06-01 at 11:14 -0700, Jim Davis wrote:
    > On Mon, Jun 1, 2015 at 11:02 AM, Joe Perches <joe@perches.com> 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.
    > >
    > > 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;
    > > + }
    >
    > Could colors be optional? Not everyone can distinguish green from
    > red, and some of us who can still prefer being colorless. (So to
    > speak.)

    Just as with git, piping though cat|less would eliminate colors,
    I suppose a --nocolor option could be added easily enough too.

    btw: it's not a patch, just a possibility/proposal.




    \
     
     \ /
      Last update: 2015-06-01 21:01    [W:3.190 / U:0.240 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site