MCPcopy Create free account
hub / github.com/XmirrorSecurity/OpenSCA-cli / Tree

Method Tree

opensca/model/dep.go:219–243  ·  view source on GitHub ↗

Tree 依赖树 path: true=>记录全部路径 false=>记录全部节点 name: true=>名称升序排序 false=>添加顺序排列

(path, name bool)

Source from the content-addressed store, hash-verified

217// path: true=>记录全部路径 false=>记录全部节点
218// name: true=>名称升序排序 false=>添加顺序排列
219func (dep *DepGraph) Tree(path, name bool) string {
220
221 if dep == nil {
222 return ""
223 }
224
225 sb := strings.Builder{}
226
227 dep.ForEach(true, path, name, func(p, n *DepGraph) bool {
228
229 if p == nil {
230 n.Expand = 0
231 } else {
232 n.Expand = p.Expand.(int) + 1
233 }
234
235 sb.WriteString(strings.Repeat(" ", n.Expand.(int)))
236 sb.WriteString(n.String())
237 sb.WriteString("\n")
238
239 return true
240 })
241
242 return sb.String()
243}
244
245// ForEach 遍历依赖图
246// deep: true=>深度优先 false=>广度优先

Callers 7

mainFunction · 0.95
RunTaskCaseFunction · 0.95
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
DiffFunction · 0.80

Calls 3

ForEachMethod · 0.95
WriteStringMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected