countSourceFiles does a quick count of source files in the project. Uses cached result from detectLanguagesFromFiles if available.
(root string)
| 347 | // countSourceFiles does a quick count of source files in the project. |
| 348 | // Uses cached result from detectLanguagesFromFiles if available. |
| 349 | func 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 | } |
no test coverage detected