Skip to content

Commit

Permalink
refactor: clarify and comment on summarisation logic
Browse files Browse the repository at this point in the history
  • Loading branch information
rade committed Dec 27, 2017
1 parent 705c6d1 commit 0b4512b
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions render/detailed/summary.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,17 +117,28 @@ func MakeBasicNodeSummary(r report.Report, n report.Node) (BasicNodeSummary, boo
if t, ok := r.Topology(n.Topology); ok {
summary.Shape = t.GetShape()
}

// Do we have a renderer for the topology?
if renderer, ok := renderers[n.Topology]; ok {
// Skip (and don't fall through to fallback) if renderer maps to nil
if renderer != nil {
return renderer(summary, n), true
if renderer == nil { // we don't want to render this
return summary, false
}
} else if _, ok := r.Topology(n.Topology); ok {
return summary, true
return renderer(summary, n), true
}

// Is it a group topology?
if strings.HasPrefix(n.Topology, "group:") {
return groupNodeSummary(summary, r, n), true
}

// Is it any known topology?
if _, ok := r.Topology(n.Topology); ok {
// We should never get here, since all known topologies are in
// 'renderers'.
return summary, true
}

// We have no idea how to render this.
return summary, false
}

Expand Down

0 comments on commit 0b4512b

Please sign in to comment.