(
rootInput: string,
options: ScanCodebaseOptions = {},
)
| 40 | } |
| 41 | |
| 42 | export async function scanCodebase( |
| 43 | rootInput: string, |
| 44 | options: ScanCodebaseOptions = {}, |
| 45 | ): Promise<FeedbackCodebaseScanResult> { |
| 46 | const root = resolve(rootInput); |
| 47 | const limits = resolveLimits(options.limits); |
| 48 | throwIfAborted(options.signal); |
| 49 | const usedGitIgnore = await isInsideGitWorkTree(root); |
| 50 | const collected = usedGitIgnore |
| 51 | ? await scanWithGit(root, limits, options.signal) |
| 52 | : await scanWithoutFilter(root, limits, options.signal); |
| 53 | const sortedFiles = collected.files.toSorted((a, b) => a.path.localeCompare(b.path)); |
| 54 | |
| 55 | return { |
| 56 | root, |
| 57 | files: sortedFiles, |
| 58 | fingerprint: fingerprintFiles(sortedFiles), |
| 59 | usedGitIgnore, |
| 60 | exceedsLimit: collected.exceedsLimit, |
| 61 | }; |
| 62 | } |
| 63 | |
| 64 | function resolveLimits(limits: ScanCodebaseOptions['limits']): ScanCodebaseLimits { |
| 65 | return { |
no test coverage detected