Skip to content

Commit a53c07e

Browse files
committed
fix: extract commit message in parseCommitData to prevent undefined error
- parseCommitData now extracts all fields from git log format including message - fixes 'Cannot read properties of undefined (reading toLowerCase())' error - get_quality_metrics can now safely check commit messages for keywords
1 parent 3751971 commit a53c07e

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/git-metrics.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,12 @@ export function parseCommitData(output: string) {
8484
if (line.includes("|")) {
8585
if (current) commits.push(current);
8686
const parts = line.split("|");
87-
const date = parts[0];
88-
const hash = parts[1] || "";
89-
current = { hash, date, files: [] };
87+
const hash = parts[0] || "";
88+
const author = parts[1] || "";
89+
const email = parts[2] || "";
90+
const date = parts[3] || "";
91+
const message = parts[4] || "";
92+
current = { hash, author, email, date, message, files: [] };
9093
} else if (line.match(/^\d+\s+\d+/) && current) {
9194
const parts = line.split(/\s+/);
9295
const add = parts[0];

0 commit comments

Comments
 (0)