| 27 | } |
| 28 | |
| 29 | func main() { |
| 30 | |
| 31 | projectDir := "../../test/php/2" |
| 32 | |
| 33 | sca := php.Sca{} |
| 34 | |
| 35 | var files []*model.File |
| 36 | filepath.WalkDir(projectDir, func(path string, d fs.DirEntry, err error) error { |
| 37 | if !sca.Filter(path) { |
| 38 | return nil |
| 39 | } |
| 40 | file := model.NewFile(path, strings.TrimPrefix(path, projectDir)) |
| 41 | files = append(files, file) |
| 42 | return nil |
| 43 | }) |
| 44 | |
| 45 | sca.Sca(context.TODO(), nil, files, func(file *model.File, root ...*model.DepGraph) { |
| 46 | for _, dep := range root { |
| 47 | dep.Build(false, sca.Language()) |
| 48 | logs.Infof("file %s:\n%s", file.Relpath(), dep.Tree(false, false)) |
| 49 | } |
| 50 | }) |
| 51 | } |