Skip to content

Commit e62ee4f

Browse files
committed
Reduce message volume/verbosity.
Only emit explantory text on the first message. Signed-off-by: Henry Cox <[email protected]>
1 parent bc814f2 commit e62ee4f

File tree

3 files changed

+164
-101
lines changed

3 files changed

+164
-101
lines changed

bin/genhtml

Lines changed: 33 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3337,16 +3337,23 @@ sub check_path_consistency
33373337
# @todo could print line numbers in baseline, current .info files and
33383338
# in diff file ..
33393339
if (lcovutil::warn_once($lcovutil::ERROR_MISMATCH, $f)) {
3340-
lcovutil::ignorable_warning($lcovutil::ERROR_MISMATCH,
3341-
"source file '$f' (in $type .info file" .
3342-
($missed{$f} == 3 ? "s" : "") .
3343-
") has same basename as 'diff' " .
3344-
($single ? 'entry ' : "entries:\n\t") . "'" .
3345-
join("'\n\t", @unused) .
3346-
"' - but a different path." .
3347-
($single ? " " : "\n\t") .
3348-
"Possible pathname mismatch? Perhaps see \"--elide-path-mismatch\" and/or \"--substitute\" options in 'man $lcovutil::tool_name'"
3349-
);
3340+
my $suffix = lcovutil::explain_once('elide-path-mismatch',
3341+
' Perhaps see "--elide-path-mismatch" and/or "--substitute" options in \'man '
3342+
. $lcovutil::tool_name . '\'');
3343+
lcovutil::ignorable_warning(
3344+
$lcovutil::ERROR_MISMATCH,
3345+
"source file '$f' (in $type .info file" .
3346+
($missed{$f} == 3 ? "s" : "") .
3347+
") has same basename as 'diff' "
3348+
.
3349+
($single ? 'entry ' : "entries:\n\t"
3350+
) .
3351+
"'" .
3352+
join("'\n\t", @unused) .
3353+
"' - but a different path." .
3354+
($single ? " " : "\n\t") .
3355+
'Possible pathname mismatch?' .
3356+
$suffix);
33503357
}
33513358
if ($main::elide_path_mismatch &&
33523359
$missed{$f} == 3 &&
@@ -4670,8 +4677,6 @@ sub nextBranchInOwnerBin
46704677
return undef;
46714678
}
46724679

4673-
my %annotateWarnings; # warn only once per file
4674-
46754680
sub _computeAge
46764681
{
46774682
my ($when, $path) = @_;
@@ -4686,13 +4691,12 @@ sub _computeAge
46864691
DateTime->now();
46874692
my $then = lcovutil::parse_w3cdtf($when);
46884693
if ($then > $now) {
4689-
unless (exists($annotateWarnings{$path})) {
4694+
if (lcovutil::warn_once($lcovutil::ERROR_INCONSISTENT_DATA, $path)) {
46904695
# issue annotation warning at most once per file
46914696
my $data =
46924697
exists($ENV{SOURCE_DATE_EPOCH}) ?
46934698
"'SOURCE_DATE_EPOCH=$ENV{SOURCE_DATE_EPOCH}'" :
46944699
"'now'";
4695-
$annotateWarnings{$path} = $now;
46964700
lcovutil::ignorable_error($lcovutil::ERROR_INCONSISTENT_DATA,
46974701
"File \"$path\": $data ($now) is older than annotate time '$when'"
46984702
);
@@ -4716,10 +4720,11 @@ sub _load
47164720
if (!defined($repo_path)) {
47174721
if (!defined($annotateCallback) &&
47184722
!$main::synthesizeMissingFile) {
4723+
my $suffix =
4724+
lcovutil::explain_once('synthesize',
4725+
' (see --synthesize-missing option to work around)');
47194726
lcovutil::ignorable_error($lcovutil::ERROR_SOURCE,
4720-
"\"" . $self->path() . "\" does not exist: $!" .
4721-
" (see --synthesize-missing option to work around)"
4722-
);
4727+
"\"" . $self->path() . "\" does not exist: $!" . $suffix);
47234728
}
47244729
$repo_path = $self->path();
47254730
}
@@ -4733,9 +4738,13 @@ sub _load
47334738
lcovutil::checkVersionMatch($repo_path, $version,
47344739
$currentVersion, 'load');
47354740
} else {
4741+
my $suffix = lcovutil::explain_once('missingVersionMsg',
4742+
"\n\tSee the 'compute_file_version' section in man lcovrc(5)."
4743+
);
47364744
lcovutil::ignorable_error($lcovutil::ERROR_VERSION,
47374745
"'$repo_path': computed '$version' but version not defined in 'current' data file "
4738-
. $main::info_filenames[0]);
4746+
. $main::info_filenames[0]
4747+
. $suffix);
47394748
}
47404749
} elsif (defined($currentVersion)) {
47414750
lcovutil::ignorable_error($lcovutil::ERROR_VERSION,
@@ -5571,13 +5580,13 @@ sub merge_child($$$)
55715580
my $name =
55725581
$childSummary->type() eq 'top' ? "" : $childSummary->name();
55735582
$SummaryInfo::coverageCriteria{$name} = $criteria;
5574-
$criteria->[1] = 0 if $criteria->[1] eq '';
5575-
my $v = $criteria->[1];
5583+
$criteria->[1] = 0 if $criteria->[1] eq '';
5584+
my $v = $criteria->[1];
55765585
die('unexpected criteria data \'' .
55775586
join(' ', @$criteria) . '\'')
55785587
unless (Scalar::Util::looks_like_number($v));
5579-
$SummaryInfo::coverageCriteriaStatus =
5580-
($v != 0 || 0 != scalar(@{$criteria->[2]})) ? $v : 0;
5588+
$SummaryInfo::coverageCriteriaStatus =
5589+
($v != 0 || 0 != scalar(@{$criteria->[2]})) ? $v : 0;
55815590
}
55825591
};
55835592
if ($@) {
@@ -6145,8 +6154,8 @@ if (0 == $exit_status && @SummaryInfo::coverageCriteriaScript) {
61456154
keys(%SummaryInfo::coverageCriteria))
61466155
) {
61476156
my $criteria = $SummaryInfo::coverageCriteria{$name};
6148-
my $v = $criteria->[1];
6149-
next if (!$v || $v == 0) && 0 == scalar(@{$criteria->[2]}); # passed
6157+
my $v = $criteria->[1];
6158+
next if (!$v || $v == 0) && 0 == scalar(@{$criteria->[2]}); # passed
61506159

61516160
my $msg = $criteria->[0];
61526161
if ($criteria->[0] ne 'top') {

0 commit comments

Comments
 (0)