MCPcopy Create free account
hub / github.com/Facets-cloud/flow / countFiles

Function countFiles

internal/stats/report.go:274–296  ·  view source on GitHub ↗

countFiles counts files ending in ext inside /*/ /.

(base, sub, ext string)

Source from the content-addressed store, hash-verified

272
273// countFiles counts files ending in ext inside <base>/*/<sub>/.
274func countFiles(base, sub, ext string) int {
275 entries, err := os.ReadDir(base)
276 if err != nil {
277 return 0
278 }
279 n := 0
280 for _, e := range entries {
281 if !e.IsDir() {
282 continue
283 }
284 inner := filepath.Join(base, e.Name(), sub)
285 files, err := os.ReadDir(inner)
286 if err != nil {
287 continue
288 }
289 for _, f := range files {
290 if !f.IsDir() && strings.HasSuffix(f.Name(), ext) {
291 n++
292 }
293 }
294 }
295 return n
296}
297
298// countKBFacts counts entry lines (starting with "- ") across kb/*.md.
299func countKBFacts(kbDir string) int {

Callers 1

BuildStatsFunction · 0.85

Calls 1

NameMethod · 0.65

Tested by

no test coverage detected