formatPrComment() — dead-code-hunter Function Reference
Architecture documentation for the formatPrComment() function in dead-code.ts from the dead-code-hunter codebase.
Entity Profile
Dependency Diagram
graph TD 96354862_3d3e_920a_e420_3c1b0ee82eec["formatPrComment()"] a3eb2ced_926a_5c50_f1b5_fa2919e7f56f["dead-code.ts"] 96354862_3d3e_920a_e420_3c1b0ee82eec -->|defined in| a3eb2ced_926a_5c50_f1b5_fa2919e7f56f 0c3136ed_f7b1_d5d1_589e_7b15515e6598["run()"] 0c3136ed_f7b1_d5d1_589e_7b15515e6598 -->|calls| 96354862_3d3e_920a_e420_3c1b0ee82eec b97956a9_58f7_affa_6ccd_bf5dd2eccf89["escapeTableCell()"] 96354862_3d3e_920a_e420_3c1b0ee82eec -->|calls| b97956a9_58f7_affa_6ccd_bf5dd2eccf89 style 96354862_3d3e_920a_e420_3c1b0ee82eec fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/dead-code.ts lines 34–85
export function formatPrComment(
candidates: DeadCodeCandidate[],
metadata?: DeadCodeAnalysisMetadata
): string {
if (candidates.length === 0) {
return `## Dead Code Hunter
No dead code found! Your codebase is clean.`;
}
const rows = candidates
.slice(0, 50)
.map(dc => {
const lineInfo = dc.line ? `L${dc.line}` : '';
const fileLink = dc.line ? `${dc.file}#L${dc.line}` : dc.file;
const badge = dc.confidence === 'high' ? ':red_circle:' :
dc.confidence === 'medium' ? ':orange_circle:' : ':yellow_circle:';
return `| \`${escapeTableCell(dc.name)}\` | ${dc.type} | ${fileLink} | ${lineInfo} | ${badge} ${dc.confidence} |`;
})
.join('\n');
let comment = `## Dead Code Hunter
Found **${candidates.length}** potentially unused code element${candidates.length === 1 ? '' : 's'}:
| Name | Type | File | Line | Confidence |
|------|------|------|------|------------|
${rows}`;
if (candidates.length > 50) {
comment += `\n\n_...and ${candidates.length - 50} more. See action output for full list._`;
}
if (metadata) {
comment += `\n\n<details><summary>Analysis summary</summary>\n\n`;
comment += `- **Total declarations analyzed**: ${metadata.totalDeclarations}\n`;
comment += `- **Dead code candidates**: ${metadata.deadCodeCandidates}\n`;
comment += `- **Alive code**: ${metadata.aliveCode}\n`;
comment += `- **Analysis method**: ${metadata.analysisMethod}\n`;
if (metadata.transitiveDeadCount != null) {
comment += `- **Transitive dead**: ${metadata.transitiveDeadCount}\n`;
}
if (metadata.symbolLevelDeadCount != null) {
comment += `- **Symbol-level dead**: ${metadata.symbolLevelDeadCount}\n`;
}
comment += `\n</details>`;
}
comment += `\n\n---\n_Powered by [Supermodel](https://supermodeltools.com) dead code analysis_`;
return comment;
}
Domain
Subdomains
Defined In
Calls
Called By
Source
Frequently Asked Questions
What does formatPrComment() do?
formatPrComment() is a function in the dead-code-hunter codebase, defined in src/dead-code.ts.
Where is formatPrComment() defined?
formatPrComment() is defined in src/dead-code.ts at line 34.
What does formatPrComment() call?
formatPrComment() calls 1 function(s): escapeTableCell.
What calls formatPrComment()?
formatPrComment() is called by 1 function(s): run.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free