Skip to content

Commit 813ad9c

Browse files
committed
only show top 50 entries for hot files and knowledge gaps
1 parent d7ff38d commit 813ad9c

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

src/git-reader/git-repository.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export class GitRepository {
3333
);
3434

3535
timeLog("getListOfCommitsWithChangedFiles");
36-
return results;
36+
return results.filter((x) => x !== null);
3737
}
3838
private async getFilesDiffWithCursor(
3939
options: GitReadOptions = {},

src/index.ts

+7-8
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,12 @@ export function clearScreen() {
4343

4444
async function collectHotFiles(commitsWithChangedFiles: ExpandedCommit[]) {
4545
const commitsPerFile = getNumberOfChangesPerFile(commitsWithChangedFiles);
46-
log(
47-
"hot files (files with most changes)",
48-
Object.keys(commitsPerFile)
49-
.map((x) => {
50-
return [x, commitsPerFile[x]];
51-
})
52-
.sort((a, b) => Number(b[1]) - Number(a[1]))
53-
);
46+
const data = Object.keys(commitsPerFile).map((x) => {
47+
return [x, commitsPerFile[x]];
48+
});
49+
data.sort((a, b) => Number(b[1]) - Number(a[1]));
50+
const hotFiles = data.slice(0, 50);
51+
log("hot files (files with most changes)", hotFiles);
5452
}
5553
async function collectKnowledgeGaps(commitsWithChangedFiles: ExpandedCommit[]) {
5654
const contributorsPerFile = getNumberOfContributorsPerFile(
@@ -63,6 +61,7 @@ async function collectKnowledgeGaps(commitsWithChangedFiles: ExpandedCommit[]) {
6361
return [x, contributorsPerFile[x]];
6462
})
6563
.sort((a, b) => Number(a[1]) - Number(b[1]))
64+
.slice(0, 50)
6665
);
6766
}
6867
function collectDetailedContributorsPerFile(

0 commit comments

Comments
 (0)