* Find the file that holds the densest concentration of the project's * internal call graph — the "core" file. Used by context-builder to * boost ranking of symbols in that file's directory (so e.g. sinatra * queries surface `lib/sinatra/base.rb`'s `route!` instead of * `sinatra-contrib/
()
| 1407 | * stamp: recomputed only after something wrote to the database. |
| 1408 | */ |
| 1409 | getDominantFile(): { filePath: string; edgeCount: number; nextEdgeCount: number } | null { |
| 1410 | // total_changes() counts writes that are later rolled back, so a result |
| 1411 | // read inside a transaction could outlive a ROLLBACK under an unchanged |
| 1412 | // stamp. Never keep one; `undefined` (a runtime without the getter) is |
| 1413 | // treated the same way. |
| 1414 | if (this.db.inTransaction !== false) { |
| 1415 | this.dominantFileMemo = undefined; |
| 1416 | return this.computeDominantFile(); |
| 1417 | } |
| 1418 | const stamp = this.getChangeStamp(); |
| 1419 | if (this.dominantFileMemo?.stamp === stamp) return this.dominantFileMemo.value; |
| 1420 | const value = this.computeDominantFile(); |
| 1421 | this.dominantFileMemo = { stamp, value }; |
| 1422 | return value; |
| 1423 | } |
| 1424 | |
| 1425 | /** |
| 1426 | * A value that differs whenever the database content may have changed |
no test coverage detected