Fix inconsistency in doctor output (#19836)

* Fix inconsistency in doctor output

- Use `logger.Info` instead of `logger.Warn` when no errors were found.

* Update modules/doctor/fix16961.go

Co-authored-by: delvh <dev.lh@web.de>

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
tokarchuk/v1.17
Gusted 3 years ago committed by GitHub
parent 40e87d031f
commit 0e516949a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      modules/doctor/fix16961.go
  2. 8
      modules/doctor/mergebase.go

@ -302,7 +302,11 @@ func fixBrokenRepoUnits16961(ctx context.Context, logger log.Logger, autofix boo
} }
if !autofix { if !autofix {
if count == 0 {
logger.Info("Found no broken repo_units")
} else {
logger.Warn("Found %d broken repo_units", count) logger.Warn("Found %d broken repo_units", count)
}
return nil return nil
} }
logger.Info("Fixed %d broken repo_units", count) logger.Info("Fixed %d broken repo_units", count)

@ -92,13 +92,15 @@ func checkPRMergeBase(ctx context.Context, logger log.Logger, autofix bool) erro
if autofix { if autofix {
logger.Info("%d PR mergebases updated of %d PRs total in %d repos", numPRsUpdated, numPRs, numRepos) logger.Info("%d PR mergebases updated of %d PRs total in %d repos", numPRsUpdated, numPRs, numRepos)
} else { } else {
if numPRsUpdated > 0 && err == nil { if numPRsUpdated == 0 {
logger.Info("All %d PRs in %d repos have a correct mergebase", numPRs, numRepos)
} else if err == nil {
logger.Critical("%d PRs with incorrect mergebases of %d PRs total in %d repos", numPRsUpdated, numPRs, numRepos) logger.Critical("%d PRs with incorrect mergebases of %d PRs total in %d repos", numPRsUpdated, numPRs, numRepos)
return fmt.Errorf("%d PRs with incorrect mergebases of %d PRs total in %d repos", numPRsUpdated, numPRs, numRepos) return fmt.Errorf("%d PRs with incorrect mergebases of %d PRs total in %d repos", numPRsUpdated, numPRs, numRepos)
} } else {
logger.Warn("%d PRs with incorrect mergebases of %d PRs total in %d repos", numPRsUpdated, numPRs, numRepos) logger.Warn("%d PRs with incorrect mergebases of %d PRs total in %d repos", numPRsUpdated, numPRs, numRepos)
} }
}
return err return err
} }

Loading…
Cancel
Save