MCPcopy
hub / github.com/ossf/scorecard / ListFiles

Method ListFiles

internal/gitfile/gitfile.go:112–128  ·  view source on GitHub ↗
(predicate func(string) (bool, error))

Source from the content-addressed store, hash-verified

110}
111
112func (h *Handler) ListFiles(predicate func(string) (bool, error)) ([]string, error) {
113 if err := h.setup(); err != nil {
114 return nil, fmt.Errorf("setup: %w", err)
115 }
116 var files []string
117 for _, f := range h.files {
118 shouldInclude, err := predicate(f)
119 if err != nil {
120 return nil, fmt.Errorf("error applying predicate to file %s: %w", f, err)
121 }
122
123 if shouldInclude {
124 files = append(files, f)
125 }
126 }
127 return files, nil
128}
129
130func enumerateFiles(repo *git.Repository) ([]string, error) {
131 ref, err := repo.Head()

Callers 1

TestHandlerFunction · 0.95

Calls 1

setupMethod · 0.95

Tested by 1

TestHandlerFunction · 0.76