(file *model.File)
| 68 | } |
| 69 | |
| 70 | func ParseRequirementTxt(file *model.File) *model.DepGraph { |
| 71 | |
| 72 | root := &model.DepGraph{Path: file.Relpath()} |
| 73 | |
| 74 | file.ReadLine(func(line string) { |
| 75 | |
| 76 | if strings.HasPrefix(line, `-r`) { |
| 77 | return |
| 78 | } |
| 79 | |
| 80 | if i := strings.Index(line, "#"); i != -1 { |
| 81 | line = line[:i] |
| 82 | } |
| 83 | |
| 84 | line = strings.TrimSpace(strings.Split(line, ";")[0]) |
| 85 | if strings.ContainsAny(line, `#$%`) || len(line) == 0 { |
| 86 | return |
| 87 | } |
| 88 | |
| 89 | if i := strings.IndexAny(line, "=!<>~"); i == -1 { |
| 90 | root.AppendChild(&model.DepGraph{Name: line}) |
| 91 | } else { |
| 92 | root.AppendChild(&model.DepGraph{Name: line[:i], Version: strings.TrimPrefix(line[i:], "==")}) |
| 93 | } |
| 94 | |
| 95 | }) |
| 96 | |
| 97 | return root |
| 98 | } |
| 99 | |
| 100 | func ParseRequirementIn(file *model.File) *model.DepGraph { |
| 101 |
no test coverage detected