From f6d7170e7785c81cdfa4233c2772c771d9208747 Mon Sep 17 00:00:00 2001 From: Leo Developer Date: Sat, 14 Aug 2021 21:14:13 +0200 Subject: [PATCH] checker: changes related to warn/error limit (#11184) --- vlib/v/builder/builder.v | 4 ++-- vlib/v/checker/checker.v | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/vlib/v/builder/builder.v b/vlib/v/builder/builder.v index 81e0116054..dff86d4010 100644 --- a/vlib/v/builder/builder.v +++ b/vlib/v/builder/builder.v @@ -342,8 +342,8 @@ fn (b &Builder) show_total_warns_and_errors_stats() { return } if b.pref.is_stats { - estring := util.bold(b.checker.nr_errors.str()) - wstring := util.bold(b.checker.nr_warnings.str()) + estring := util.bold(b.checker.errors.len.str()) + wstring := util.bold(b.checker.warnings.len.str()) nstring := util.bold(b.checker.nr_notices.str()) println('checker summary: $estring V errors, $wstring V warnings, $nstring V notices') } diff --git a/vlib/v/checker/checker.v b/vlib/v/checker/checker.v index 468c0d3546..33beed6ed3 100644 --- a/vlib/v/checker/checker.v +++ b/vlib/v/checker/checker.v @@ -7593,6 +7593,9 @@ fn (c &Checker) check_struct_signature(from ast.Struct, to ast.Struct) bool { } pub fn (mut c Checker) note(message string, pos token.Position) { + if c.nr_notices >= c.pref.warn_error_limit && c.pref.warn_error_limit >= 0 { + return + } mut details := '' if c.error_details.len > 0 { details = c.error_details.join('\n') @@ -7641,7 +7644,7 @@ fn (mut c Checker) warn_or_error(message string, pos token.Position, warn bool) exit(1) } c.nr_errors++ - if c.nr_errors < c.pref.warn_error_limit || c.pref.warn_error_limit < 0 { + if c.errors.len < c.pref.warn_error_limit || c.pref.warn_error_limit < 0 { if pos.line_nr !in c.error_lines { err := errors.Error{ reporter: errors.Reporter.checker