Skip to content

Commit 6627a31

Browse files
committed
fix: defensive percentage parsing in naming consistency display
1 parent a80bf8e commit 6627a31

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

frontend/src/components/RepoSummaryCard.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,11 @@ function generateSummary(repo: Repository, insights: any, style: any) {
154154

155155
main += `${primaryLang} codebase with ${functionCount.toLocaleString()} functions across ${fileCount} files. `
156156

157-
if (namingStyle) {
157+
if (namingStyle && primaryNaming) {
158158
main += `The code primarily uses ${namingStyle} naming conventions`
159-
if (primaryNaming && parseFloat((primaryNaming[1] as any).percentage) > 80) {
160-
main += ` (${(primaryNaming[1] as any).percentage} consistency)`
159+
const consistencyPct = parseFloat((primaryNaming[1] as any)?.percentage ?? '0') || 0
160+
if (consistencyPct > 80) {
161+
main += ` (${consistencyPct}% consistency)`
161162
}
162163
main += '. '
163164
}

0 commit comments

Comments
 (0)