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

Function countKBFacts

internal/stats/report.go:299–320  ·  view source on GitHub ↗

countKBFacts counts entry lines (starting with "- ") across kb/*.md.

(kbDir string)

Source from the content-addressed store, hash-verified

297
298// countKBFacts counts entry lines (starting with "- ") across kb/*.md.
299func countKBFacts(kbDir string) int {
300 entries, err := os.ReadDir(kbDir)
301 if err != nil {
302 return 0
303 }
304 n := 0
305 for _, e := range entries {
306 if e.IsDir() || !strings.HasSuffix(e.Name(), ".md") {
307 continue
308 }
309 data, err := os.ReadFile(filepath.Join(kbDir, e.Name()))
310 if err != nil {
311 continue
312 }
313 for _, line := range strings.Split(string(data), "\n") {
314 if strings.HasPrefix(line, "- ") {
315 n++
316 }
317 }
318 }
319 return n
320}

Callers 1

BuildStatsFunction · 0.85

Calls 1

NameMethod · 0.65

Tested by

no test coverage detected