MCPcopy Index your code
hub / github.com/XmirrorSecurity/OpenSCA-cli / ParseRequirementIn

Function ParseRequirementIn

opensca/sca/python/pip.go:100–121  ·  view source on GitHub ↗
(file *model.File)

Source from the content-addressed store, hash-verified

98}
99
100func ParseRequirementIn(file *model.File) *model.DepGraph {
101
102 root := &model.DepGraph{Path: file.Relpath()}
103
104 file.ReadLine(func(line string) {
105
106 if strings.HasPrefix(line, `#`) {
107 return
108 }
109
110 words := strings.Fields(line)
111 if len(words) > 0 {
112 dep := &model.DepGraph{}
113 dep.Name = words[0]
114 dep.Version = strings.Join(words[1:], "")
115 root.AppendChild(dep)
116 }
117
118 })
119
120 return root
121}

Callers 1

ScaMethod · 0.85

Calls 3

AppendChildMethod · 0.95
RelpathMethod · 0.80
ReadLineMethod · 0.80

Tested by

no test coverage detected