in internal/reports/report_helpers.go [725:753]
func RateSchema(cols, warnings, errors int64, missingPKey, summary bool) (string, string) {
pkMsg := "missing primary key"
s := fmt.Sprintf(" (%s%% of %d columns mapped cleanly)", pct(cols, warnings), cols)
if summary {
pkMsg = "some missing primary keys"
}
switch {
case cols == 0:
return "NONE", "NONE (no schema found)"
case errors != 0:
return "POOR", "POOR" + s
case warnings == 0 && !missingPKey:
return "EXCELLENT", fmt.Sprintf("EXCELLENT (all %d columns mapped cleanly)", cols)
case warnings == 0 && missingPKey:
return "GOOD", fmt.Sprintf("GOOD (all columns mapped cleanly, but %s)", pkMsg)
case good(cols, warnings) && !missingPKey:
return "GOOD", "GOOD" + s
case good(cols, warnings) && missingPKey:
return "GOOD", "GOOD" + s + fmt.Sprintf(" + %s", pkMsg)
case ok(cols, warnings) && !missingPKey:
return "OK", "OK" + s
case ok(cols, warnings) && missingPKey:
return "OK", "OK" + s + fmt.Sprintf(" + %s", pkMsg)
case !missingPKey:
return "POOR", "POOR" + s
default:
return "POOR", "POOR" + s + fmt.Sprintf(" + %s", pkMsg)
}
}