(file *model.File)
| 42 | } |
| 43 | |
| 44 | func ParsePipfileLock(file *model.File) *model.DepGraph { |
| 45 | |
| 46 | lock := struct { |
| 47 | Default map[string]struct { |
| 48 | Version string `json:"version"` |
| 49 | } `json:"default"` |
| 50 | }{} |
| 51 | |
| 52 | root := &model.DepGraph{Path: file.Relpath()} |
| 53 | |
| 54 | _dep := model.NewDepGraphMap(nil, func(s ...string) *model.DepGraph { return &model.DepGraph{Name: s[0], Version: s[1]} }).LoadOrStore |
| 55 | |
| 56 | file.OpenReader(func(reader io.Reader) { |
| 57 | if err := json.NewDecoder(reader).Decode(&lock); err != nil { |
| 58 | logs.Warnf("unmarshal file %s err: %s", file.Relpath(), err) |
| 59 | } |
| 60 | }) |
| 61 | |
| 62 | for name, v := range lock.Default { |
| 63 | version := strings.TrimPrefix(v.Version, "==") |
| 64 | root.AppendChild(_dep(name, version)) |
| 65 | } |
| 66 | |
| 67 | return root |
| 68 | } |
| 69 | |
| 70 | func ParseRequirementTxt(file *model.File) *model.DepGraph { |
| 71 |
no test coverage detected