MCPcopy Create free account
hub / github.com/JordanCoin/codemap / countSourceFiles

Function countSourceFiles

cmd/context.go:349–361  ·  view source on GitHub ↗

countSourceFiles does a quick count of source files in the project. Uses cached result from detectLanguagesFromFiles if available.

(root string)

Source from the content-addressed store, hash-verified

347// countSourceFiles does a quick count of source files in the project.
348// Uses cached result from detectLanguagesFromFiles if available.
349func countSourceFiles(root string) int {
350 if cachedFileCount >= 0 {
351 count := cachedFileCount
352 cachedFileCount = -1 // reset for next call
353 return count
354 }
355 gitCache := scanner.NewGitIgnoreCache(root)
356 files, err := scanner.ScanFiles(root, gitCache, nil, nil)
357 if err != nil {
358 return 0
359 }
360 return len(files)
361}

Callers 1

buildProjectContextFunction · 0.85

Calls 2

NewGitIgnoreCacheFunction · 0.92
ScanFilesFunction · 0.92

Tested by

no test coverage detected