implements: don't panic if no counts for C functions are avaiable

Signed-off-by: John Mulligan <jmulligan@redhat.com>
This commit is contained in:
John Mulligan 2021-09-21 14:44:39 -04:00 committed by mergify[bot]
parent 29c18bcfd0
commit 961ff19bfd
1 changed files with 8 additions and 3 deletions

View File

@ -51,19 +51,24 @@ func (r *TextReport) Report(name string, ii *Inspector) error {
found := len(ii.found) found := len(ii.found)
total := len(ii.expected) total := len(ii.expected)
missing := total - found - ii.deprecatedMissing
var percentFound, percentMissing int
if total > 0 {
percentFound = (100 * found) / total
percentMissing = (100 * missing) / total
}
r.printf( r.printf(
"%s functions covered: %d/%d : %v%%\n", "%s functions covered: %d/%d : %v%%\n",
packageLabel, packageLabel,
found, found,
total, total,
(100*found)/total) percentFound)
missing := total - found - ii.deprecatedMissing
r.printf( r.printf(
"%s functions missing: %d/%d : %v%%\n", "%s functions missing: %d/%d : %v%%\n",
packageLabel, packageLabel,
missing, missing,
total, total,
(100*missing)/total) percentMissing)
r.printf( r.printf(
" (note missing count does not include deprecated functions in ceph)\n") " (note missing count does not include deprecated functions in ceph)\n")