Skip to content

Commit 0bb8724

Browse files
Applying Coderabbit suggestions
1 parent 668265c commit 0bb8724

3 files changed

Lines changed: 10 additions & 11 deletions

File tree

‎assets/refactor-first-report.mustache‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@
584584
<td class="rf-text-right">{{cycleCount}}</td>
585585
<td class="rf-text-right">{{effortRank}}</td>
586586
<td class="rf-text-left">{{#classRelationshipsToBreakPackage}}
587-
{{{safeRenderedLabel}}}<br>{{/classRelationshipsToBreakPackage}}</td>
587+
{{{.}}}<br>{{/classRelationshipsToBreakPackage}}</td>
588588
</tr>
589589
{{/packageRelationshipsToRemove.relationships}}
590590
</tbody>

‎lib/renderer.js‎

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,20 +68,19 @@ function sanitizeRelationshipLabel(label) {
6868
}
6969

7070
/**
71-
* Normalizes one "class relationship to break a package cycle" entry.
72-
* Reports serialize ClassRelationshipDTO objects; entries of any other
73-
* shape (including pre-DTO rendered-label strings) are dropped.
71+
* Adapts one "class relationship to break a package cycle" entry for the
72+
* template. Reports serialize structured ClassRelationshipDTO objects, and
73+
* the template renders each entry as a raw string, so the entry is replaced
74+
* by its rendered label, sanitized to links and removal markers. Entries
75+
* of any other shape (including pre-DTO rendered-label strings) are dropped.
7476
*
7577
* @param {*} entry - Raw class-break entry.
76-
* @returns {object|null} Entry extended with a sanitized label, or null when
77-
* the entry is not a valid ClassRelationshipDTO object.
78+
* @returns {string|null} Sanitized label markup, or null when the entry is
79+
* not a valid ClassRelationshipDTO object.
7880
*/
7981
function prepareClassBreakEntry(entry) {
8082
if (!entry || typeof entry !== 'object') return null;
81-
return {
82-
...entry,
83-
safeRenderedLabel: sanitizeRelationshipLabel(entry.renderedLabel)
84-
};
83+
return sanitizeRelationshipLabel(entry.renderedLabel);
8584
}
8685

8786
/**

‎public/assets/refactor-first-report.mustache‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@
584584
<td class="rf-text-right">{{cycleCount}}</td>
585585
<td class="rf-text-right">{{effortRank}}</td>
586586
<td class="rf-text-left">{{#classRelationshipsToBreakPackage}}
587-
{{{safeRenderedLabel}}}<br>{{/classRelationshipsToBreakPackage}}</td>
587+
{{{.}}}<br>{{/classRelationshipsToBreakPackage}}</td>
588588
</tr>
589589
{{/packageRelationshipsToRemove.relationships}}
590590
</tbody>

0 commit comments

Comments
 (0)