Skip to content

Commit f6373ab

Browse files
committed
fix: deduplicate directImporters to prevent negative transitive count (#480)
findImportSources can return multiple edges to the same file (e.g. imports + imports-type), causing importedBy.length to exceed totalImporterCount and produce a negative transitive suffix.
1 parent 6be9191 commit f6373ab

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/domain/analysis/brief.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ export function briefData(file, customDbPath, opts = {}) {
114114
// Direct importers
115115
let importedBy = findImportSources(db, fn.id);
116116
if (noTests) importedBy = importedBy.filter((i) => !isTestFile(i.file));
117-
const directImporters = importedBy.map((i) => i.file);
117+
const directImporters = [...new Set(importedBy.map((i) => i.file))];
118118

119119
// Transitive importer count
120120
const totalImporterCount = countTransitiveImporters(db, [fn.id], noTests);

0 commit comments

Comments
 (0)