* Check multiple files, return cached vs uncached
(filePaths: string[], contents: string[])
| 390 | * Check multiple files, return cached vs uncached |
| 391 | */ |
| 392 | async checkFiles(filePaths: string[], contents: string[]): Promise<{ |
| 393 | cached: { path: string; content: string }[]; |
| 394 | uncached: { path: string; content: string }[]; |
| 395 | }> { |
| 396 | await this.initPromise; |
| 397 | |
| 398 | const cached: { path: string; content: string }[] = []; |
| 399 | const uncached: { path: string; content: string }[] = []; |
| 400 | |
| 401 | for (let i = 0; i < filePaths.length; i++) { |
| 402 | const fp = filePaths[i]; |
| 403 | const content = contents[i]; |
| 404 | const hash = this.hashContentAST(content, fp); |
| 405 | const normalizedPath = this.toRelativePath(fp); |
| 406 | const cachedEntry = this.files[normalizedPath]; |
| 407 | |
| 408 | if (this.isFileValid(fp, hash)) { |
| 409 | cached.push({ path: fp, content }); |
| 410 | } else { |
| 411 | uncached.push({ path: fp, content }); |
| 412 | } |
| 413 | } |
| 414 | |
| 415 | return { cached, uncached }; |
| 416 | } |
| 417 | |
| 418 | // ========================================================================= |
| 419 | // Store Analysis Results |
no test coverage detected