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

Method Build

opensca/model/dep.go:177–197  ·  view source on GitHub ↗

Build 构建依赖图路径 deep: 依赖路径构建顺序 true=>深度优先 false=>广度优先 广度优先的路径更短 如果不清楚该用什么推荐false lan: 更新依赖语言

(deep bool, lan Language)

Source from the content-addressed store, hash-verified

175// 广度优先的路径更短 如果不清楚该用什么推荐false
176// lan: 更新依赖语言
177func (dep *DepGraph) Build(deep bool, lan Language) {
178 dep.Flush()
179 dep.ForEach(deep, false, false, func(p, n *DepGraph) bool {
180 // 补全路径
181 if p != nil && n.Path == "" {
182 n.Path = p.Path
183 }
184 if n.Name != "" {
185 n.Path = filepath.Join(n.Path, n.Index())
186 }
187 // 补全语言
188 if n.Language == Lan_None {
189 n.Language = lan
190 }
191 // 直接依赖
192 if len(n.Parents) == 0 || len(p.Parents) == 0 {
193 n.Direct = true
194 }
195 return true
196 })
197}
198
199// RemoveDevelop 移除develop组件
200func (dep *DepGraph) RemoveDevelop() {

Callers 5

mainFunction · 0.95
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
RunTaskFunction · 0.80

Calls 3

FlushMethod · 0.95
ForEachMethod · 0.95
IndexMethod · 0.80

Tested by

no test coverage detected