From nobody Sun May 5 03:00:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543482413419132.65397388235783; Thu, 29 Nov 2018 01:06:53 -0800 (PST) Received: from localhost ([::1]:52960 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSIHc-00073R-A6 for importer@patchew.org; Thu, 29 Nov 2018 04:06:52 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54103) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSICQ-0002Bi-DA for qemu-devel@nongnu.org; Thu, 29 Nov 2018 04:01:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gSICK-0002oe-I9 for qemu-devel@nongnu.org; Thu, 29 Nov 2018 04:01:30 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56854) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gSICK-0002o6-Ap for qemu-devel@nongnu.org; Thu, 29 Nov 2018 04:01:24 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id ACC4A89ADD for ; Thu, 29 Nov 2018 09:01:23 +0000 (UTC) Received: from donizetti.redhat.com (ovpn-112-25.ams2.redhat.com [10.36.112.25]) by smtp.corp.redhat.com (Postfix) with ESMTP id ACF50171A7; Thu, 29 Nov 2018 09:01:22 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Thu, 29 Nov 2018 10:01:17 +0100 Message-Id: <20181129090120.28828-2-pbonzini@redhat.com> In-Reply-To: <20181129090120.28828-1-pbonzini@redhat.com> References: <20181129090120.28828-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 29 Nov 2018 09:01:23 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-4.0 1/4] checkpatch: fix premature exit when no input or --mailback X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" In some cases, checkpatch's process subroutine is exiting the whole process. This is wrong, just return from the subroutine instead. Signed-off-by: Paolo Bonzini Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- scripts/checkpatch.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index eccd656c41..d58fcb1efd 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2869,19 +2869,19 @@ sub process { # If we have no input at all, then there is nothing to report on # so just keep quiet. if ($#rawlines =3D=3D -1) { - exit(0); + return 1; } =20 # In mailback mode only produce a report in the negative, for # things that appear to be patches. if ($mailback && ($clean =3D=3D 1 || !$is_patch)) { - exit(0); + return 1; } =20 # This is not a patch, and we are are in 'no-patch' mode so # just keep quiet. if (!$chk_patch && !$is_patch) { - exit(0); + return 1; } =20 if (!$is_patch) { --=20 2.19.1 From nobody Sun May 5 03:00:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543482248675300.85347103462095; Thu, 29 Nov 2018 01:04:08 -0800 (PST) Received: from localhost ([::1]:52943 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSIEw-00056a-Ts for importer@patchew.org; Thu, 29 Nov 2018 04:04:06 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54127) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSICR-0002CT-QC for qemu-devel@nongnu.org; Thu, 29 Nov 2018 04:01:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gSICM-0002qT-1y for qemu-devel@nongnu.org; Thu, 29 Nov 2018 04:01:31 -0500 Received: from mx1.redhat.com ([209.132.183.28]:42626) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gSICL-0002pD-QD for qemu-devel@nongnu.org; Thu, 29 Nov 2018 04:01:25 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2BA6781DFA for ; Thu, 29 Nov 2018 09:01:25 +0000 (UTC) Received: from donizetti.redhat.com (ovpn-112-25.ams2.redhat.com [10.36.112.25]) by smtp.corp.redhat.com (Postfix) with ESMTP id 219EA171CD; Thu, 29 Nov 2018 09:01:23 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Thu, 29 Nov 2018 10:01:18 +0100 Message-Id: <20181129090120.28828-3-pbonzini@redhat.com> In-Reply-To: <20181129090120.28828-1-pbonzini@redhat.com> References: <20181129090120.28828-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 29 Nov 2018 09:01:25 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-4.0 2/4] checkpatch: check Signed-off-by in --mailback mode X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Pull the test before the anticipated exits from the process sub. Signed-off-by: Paolo Bonzini Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- scripts/checkpatch.pl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index d58fcb1efd..c216c55e01 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2866,6 +2866,10 @@ sub process { } } =20 + if ($is_patch && $chk_signoff && $signoff =3D=3D 0) { + ERROR("Missing Signed-off-by: line(s)\n"); + } + # If we have no input at all, then there is nothing to report on # so just keep quiet. if ($#rawlines =3D=3D -1) { @@ -2887,9 +2891,6 @@ sub process { if (!$is_patch) { ERROR("Does not appear to be a unified-diff format patch\n"); } - if ($is_patch && $chk_signoff && $signoff =3D=3D 0) { - ERROR("Missing Signed-off-by: line(s)\n"); - } =20 print report_dump(); if ($summary && !($clean =3D=3D 1 && $quiet =3D=3D 1)) { --=20 2.19.1 From nobody Sun May 5 03:00:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543482413784446.37371480770605; Thu, 29 Nov 2018 01:06:53 -0800 (PST) Received: from localhost ([::1]:52958 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSIHV-0006vt-RU for importer@patchew.org; Thu, 29 Nov 2018 04:06:45 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54076) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSICO-0002A9-Gs for qemu-devel@nongnu.org; Thu, 29 Nov 2018 04:01:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gSICN-0002sT-J6 for qemu-devel@nongnu.org; Thu, 29 Nov 2018 04:01:28 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52696) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gSICN-0002rZ-Au for qemu-devel@nongnu.org; Thu, 29 Nov 2018 04:01:27 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B149D3154871 for ; Thu, 29 Nov 2018 09:01:26 +0000 (UTC) Received: from donizetti.redhat.com (ovpn-112-25.ams2.redhat.com [10.36.112.25]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9CFE95C883; Thu, 29 Nov 2018 09:01:25 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Thu, 29 Nov 2018 10:01:19 +0100 Message-Id: <20181129090120.28828-4-pbonzini@redhat.com> In-Reply-To: <20181129090120.28828-1-pbonzini@redhat.com> References: <20181129090120.28828-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Thu, 29 Nov 2018 09:01:26 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-4.0 3/4] checkpatch: improve handling of multiple patches or files X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Similar to how patchew output looks like for multiple patches, say what file or patch is being tested _before_ emitting errors. This is clearer to a human that scans the output from top to bottom. In addition, provide a truncated commit hash and subject instead of the full hash, and process the commits first-to-last rather than last-to-first. Inspired by Linux commit 0dea9f1eef86bedacad91b6f652ca1ab0d08854c ("checkpatch: reduce number of `git log` calls with --git", 2016-03-20). Signed-off-by: Paolo Bonzini --- scripts/checkpatch.pl | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index c216c55e01..f5284d910c 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -340,13 +340,18 @@ my @lines =3D (); my $vname; if ($chk_branch) { my @patches; + my %git_commits =3D (); my $HASH; - open($HASH, "-|", "git", "log", "--format=3D%H", $ARGV[0]) || - die "$P: git log --format=3D%H $ARGV[0] failed - $!\n"; - - while (<$HASH>) { - chomp; - push @patches, $_; + open($HASH, "-|", "git", "log", "--reverse", "--no-merges", "--format=3D%= H %s", $ARGV[0]) || + die "$P: git log --reverse --no-merges --format=3D'%H %s' $ARGV[0] faile= d - $!\n"; + + for my $line (<$HASH>) { + $line =3D~ /^([0-9a-fA-F]{40,40}) (.*)$/; + next if (!defined($1) || !defined($2)); + my $sha1 =3D $1; + my $subject =3D $2; + push(@patches, $sha1); + $git_commits{$sha1} =3D $subject; } =20 close $HASH; @@ -354,21 +359,31 @@ if ($chk_branch) { die "$P: no revisions returned for revlist '$chk_branch'\n" unless @patches; =20 + my $i =3D 1; + my $num_patches =3D @patches; for my $hash (@patches) { my $FILE; open($FILE, '-|', "git", "show", $hash) || die "$P: git show $hash - $!\n"; - $vname =3D $hash; while (<$FILE>) { chomp; push(@rawlines, $_); } close($FILE); + $vname =3D substr($hash, 0, 12) . ' (' . $git_commits{$hash} . ')'; + if ($num_patches > 1 && $quiet =3D=3D 0) { + print "$i/$num_patches Checking commit $vname\n"; + $vname =3D "Patch $i/$num_patches"; + } else { + $vname =3D "Commit " . $vname; + } if (!process($hash)) { $exit =3D 1; + print "\n" if ($num_patches > 1 && $quiet =3D=3D 0); } @rawlines =3D (); @lines =3D (); + $i++; } } else { for my $filename (@ARGV) { @@ -387,6 +402,7 @@ if ($chk_branch) { } else { $vname =3D $filename; } + print "Checking $filename...\n" if @ARGV > 1 && $quiet =3D=3D 0; while (<$FILE>) { chomp; push(@rawlines, $_); --=20 2.19.1 From nobody Sun May 5 03:00:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543482246606253.71076020169846; Thu, 29 Nov 2018 01:04:06 -0800 (PST) Received: from localhost ([::1]:52942 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSIEr-0004y3-EB for importer@patchew.org; Thu, 29 Nov 2018 04:04:01 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54115) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSICR-0002C9-1p for qemu-devel@nongnu.org; Thu, 29 Nov 2018 04:01:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gSICO-0002ux-WC for qemu-devel@nongnu.org; Thu, 29 Nov 2018 04:01:30 -0500 Received: from mx1.redhat.com ([209.132.183.28]:36272) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gSICO-0002tO-OT for qemu-devel@nongnu.org; Thu, 29 Nov 2018 04:01:28 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1FB7531256A7 for ; Thu, 29 Nov 2018 09:01:28 +0000 (UTC) Received: from donizetti.redhat.com (ovpn-112-25.ams2.redhat.com [10.36.112.25]) by smtp.corp.redhat.com (Postfix) with ESMTP id 19DEE171A7; Thu, 29 Nov 2018 09:01:26 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Thu, 29 Nov 2018 10:01:20 +0100 Message-Id: <20181129090120.28828-5-pbonzini@redhat.com> In-Reply-To: <20181129090120.28828-1-pbonzini@redhat.com> References: <20181129090120.28828-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Thu, 29 Nov 2018 09:01:28 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-4.0 4/4] checkpatch: colorize output to terminal X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Add optional colors to make seeing message types a bit easier. The default is to show them on a tty. The chosen colors should resemble gcc's. Inspired by Linux commit 57230297116faf5b0a995916d5dd5fedab54cba3 ("checkpatch: colorize output to terminal"). Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- scripts/checkpatch.pl | 51 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 44 insertions(+), 7 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index f5284d910c..14be11719c 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -7,6 +7,7 @@ =20 use strict; use warnings; +use Term::ANSIColor qw(:constants); =20 my $P =3D $0; $P =3D~ s@.*/@@g; @@ -26,6 +27,7 @@ my $tst_only; my $emacs =3D 0; my $terse =3D 0; my $file =3D undef; +my $color =3D "auto"; my $no_warnings =3D 0; my $summary =3D 1; my $mailback =3D 0; @@ -64,6 +66,8 @@ Options: is all off) --test-only=3DWORD report only warnings/errors containing WORD literally + --color[=3DWHEN] Use colors 'always', 'never', or only when = output + is a terminal ('auto'). Default is 'auto'. -h, --help, --version display this help and exit =20 When FILE is - read standard input. @@ -72,6 +76,14 @@ EOM exit($exitcode); } =20 +# Perl's Getopt::Long allows options to take optional arguments after a sp= ace. +# Prevent --color by itself from consuming other arguments +foreach (@ARGV) { + if ($_ eq "--color" || $_ eq "-color") { + $_ =3D "--color=3D$color"; + } +} + GetOptions( 'q|quiet+' =3D> \$quiet, 'tree!' =3D> \$tree, @@ -89,6 +101,8 @@ GetOptions( =20 'debug=3Ds' =3D> \%debug, 'test-only=3Ds' =3D> \$tst_only, + 'color=3Ds' =3D> \$color, + 'no-color' =3D> sub { $color =3D 'never'; }, 'h|help' =3D> \$help, 'version' =3D> \$help ) or help(1); @@ -144,6 +158,18 @@ if (!$chk_patch && !$chk_branch && !$file) { die "One of --file, --branch, --patch is required\n"; } =20 +if ($color =3D~ /^[01]$/) { + $color =3D !$color; +} elsif ($color =3D~ /^always$/i) { + $color =3D 1; +} elsif ($color =3D~ /^never$/i) { + $color =3D 0; +} elsif ($color =3D~ /^auto$/i) { + $color =3D (-t STDOUT); +} else { + die "Invalid color mode: $color\n"; +} + my $dbg_values =3D 0; my $dbg_possible =3D 0; my $dbg_type =3D 0; @@ -372,7 +398,9 @@ if ($chk_branch) { close($FILE); $vname =3D substr($hash, 0, 12) . ' (' . $git_commits{$hash} . ')'; if ($num_patches > 1 && $quiet =3D=3D 0) { - print "$i/$num_patches Checking commit $vname\n"; + my $prefix =3D "$i/$num_patches"; + $prefix =3D BLUE . BOLD . $prefix . RESET if $color; + print "$prefix Checking commit $vname\n"; $vname =3D "Patch $i/$num_patches"; } else { $vname =3D "Commit " . $vname; @@ -1182,14 +1210,23 @@ sub possible { my $prefix =3D ''; =20 sub report { - if (defined $tst_only && $_[0] !~ /\Q$tst_only\E/) { + my ($level, $msg) =3D @_; + if (defined $tst_only && $msg !~ /\Q$tst_only\E/) { return 0; } - my $line =3D $prefix . $_[0]; =20 - $line =3D (split('\n', $line))[0] . "\n" if ($terse); + my $output =3D ''; + $output .=3D BOLD if $color; + $output .=3D $prefix; + $output .=3D RED if $color && $level eq 'ERROR'; + $output .=3D MAGENTA if $color && $level eq 'WARNING'; + $output .=3D $level . ':'; + $output .=3D RESET if $color; + $output .=3D ' ' . $msg . "\n"; + + $output =3D (split('\n', $output))[0] . "\n" if ($terse); =20 - push(our @report, $line); + push(our @report, $output); =20 return 1; } @@ -1197,13 +1234,13 @@ sub report_dump { our @report; } sub ERROR { - if (report("ERROR: $_[0]\n")) { + if (report("ERROR", $_[0])) { our $clean =3D 0; our $cnt_error++; } } sub WARN { - if (report("WARNING: $_[0]\n")) { + if (report("WARNING", $_[0])) { our $clean =3D 0; our $cnt_warn++; } --=20 2.19.1