(report: JsonObject)
| 281 | } |
| 282 | |
| 283 | function topMaintainerRows(report: JsonObject): string[] { |
| 284 | const rows = Array.isArray(report.maintainers) ? report.maintainers.map(asJsonObject) : []; |
| 285 | return rows |
| 286 | .filter((row) => { |
| 287 | const github = asJsonObject(row.github); |
| 288 | const discord = asJsonObject(row.discord); |
| 289 | return numberValue(github.total) > 0 || numberValue(discord.total) > 0; |
| 290 | }) |
| 291 | .slice(0, MAX_HIGHLIGHTS) |
| 292 | .map((row) => { |
| 293 | const github = asJsonObject(row.github); |
| 294 | const discord = asJsonObject(row.discord); |
| 295 | const bits = [ |
| 296 | metric(github.commits, "commits"), |
| 297 | metric(github.prsMerged, "merged PRs"), |
| 298 | metric(github.issueComments, "comments"), |
| 299 | metric(discord.total, "Discord messages"), |
| 300 | ].filter(Boolean); |
| 301 | const name = stringOrNull(row.name) ?? `@${stringOrNull(row.login) ?? "unknown"}`; |
| 302 | return `${name}: ${bits.slice(0, 3).join(", ") || "activity"}`; |
| 303 | }); |
| 304 | } |
| 305 | |
| 306 | function metric(value: unknown, label: string): string { |
| 307 | const number = numberValue(value); |
no test coverage detected