checker: changes related to warn/error limit (#11184)

pull/11187/head
Leo Developer 2021-08-14 21:14:13 +02:00 committed by GitHub
parent 1743ad05c0
commit f6d7170e77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -342,8 +342,8 @@ fn (b &Builder) show_total_warns_and_errors_stats() {
return return
} }
if b.pref.is_stats { if b.pref.is_stats {
estring := util.bold(b.checker.nr_errors.str()) estring := util.bold(b.checker.errors.len.str())
wstring := util.bold(b.checker.nr_warnings.str()) wstring := util.bold(b.checker.warnings.len.str())
nstring := util.bold(b.checker.nr_notices.str()) nstring := util.bold(b.checker.nr_notices.str())
println('checker summary: $estring V errors, $wstring V warnings, $nstring V notices') println('checker summary: $estring V errors, $wstring V warnings, $nstring V notices')
} }

View File

@ -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) { 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 := '' mut details := ''
if c.error_details.len > 0 { if c.error_details.len > 0 {
details = c.error_details.join('\n') 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) exit(1)
} }
c.nr_errors++ 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 { if pos.line_nr !in c.error_lines {
err := errors.Error{ err := errors.Error{
reporter: errors.Reporter.checker reporter: errors.Reporter.checker