@@ -308,35 +308,9 @@ public StringBuilder generateReport(
308308 }
309309
310310 stringBuilder .append ("<header>\n " + "<nav>\n " + " <ul>\n " );
311-
312- if (!edgesToRemove .isEmpty ()) {
313- stringBuilder .append ("<li><a href=\" #EDGES\" >Edges To Remove</a></li>\n " );
314- }
315-
316- if (!disharmonySpecs .isEmpty ()) {
317- stringBuilder .append ("<li><a href=\" #\" >Disharmonies</a>\n " + " <ul>" );
318- }
319-
320- for (DisharmonySpec spec : disharmonySpecs ) {
321- if (rankedDisharmoniesByAnchor .containsKey (spec .anchorId ())) {
322- stringBuilder
323- .append ("<li><a href=\" #" )
324- .append (spec .anchorId ())
325- .append ("\" >" )
326- .append (spec .title ())
327- .append ("</a></li>\n " );
328- }
329- }
330-
331- if (!disharmonySpecs .isEmpty ()) {
332- stringBuilder .append ("</ul>\n " + " </li>" );
333- }
334-
335- if (!rankedCycles .isEmpty ()) {
336- stringBuilder .append ("<li><a href=\" #CYCLES\" >Class Cycles</a></li>\n " );
337- }
338-
311+ stringBuilder .append (createMenu (disharmonySpecs , rankedDisharmoniesByAnchor , rankedCycles ));
339312 stringBuilder .append ("</ul>\n " + "</nav>\n " + "</header>\n " );
313+
340314 log .info ("Generating HTML Report" );
341315
342316 stringBuilder .append (renderClassGraphVisuals (repoUrl , codebaseGraphDTO ));
@@ -366,6 +340,40 @@ public StringBuilder generateReport(
366340 return stringBuilder ;
367341 }
368342
343+ StringBuilder createMenu (
344+ List <DisharmonySpec > disharmonySpecs ,
345+ Map <String , List <RankedDisharmony >> rankedDisharmoniesByAnchor ,
346+ List <RankedCycle > rankedCycles ) {
347+ StringBuilder menu = new StringBuilder ();
348+ if (!edgesToRemove .isEmpty ()) {
349+ menu .append ("<li><a href=\" #EDGES\" >Edges To Remove</a></li>\n " );
350+ }
351+
352+ if (!disharmonySpecs .isEmpty ()) {
353+ menu .append ("<li><a href=\" #\" >Disharmonies</a>\n " + " <ul>" );
354+ }
355+
356+ for (DisharmonySpec spec : disharmonySpecs ) {
357+ if (rankedDisharmoniesByAnchor .containsKey (spec .anchorId ())) {
358+ menu .append ("<li><a href=\" #" )
359+ .append (spec .anchorId ())
360+ .append ("\" >" )
361+ .append (spec .title ())
362+ .append ("</a></li>\n " );
363+ }
364+ }
365+
366+ if (!disharmonySpecs .isEmpty ()) {
367+ menu .append ("</ul>\n " + " </li>" );
368+ }
369+
370+ if (!rankedCycles .isEmpty ()) {
371+ menu .append ("<li><a href=\" #CYCLES\" >Class Cycles</a></li>\n " );
372+ menu .append ("<li><a href=\" #CYCLEMAP\" >Cycle Map</a></li>\n " );
373+ }
374+ return menu ;
375+ }
376+
369377 private String renderCycles (List <RankedCycle > rankedCycles , String repoUrl , CodebaseGraphDTO codebaseGraphDTO ) {
370378 StringBuilder stringBuilder = new StringBuilder ();
371379 stringBuilder .append (renderClassCycleSummary (rankedCycles ));
@@ -579,8 +587,8 @@ private String renderSingleCycle(RankedCycle cycle, String repoUrl, CodebaseGrap
579587 stringBuilder .append ("<br/>\n " );
580588 stringBuilder .append ("<br/>\n " );
581589
582- stringBuilder .append (
583- "<h2 align= \" center \" >Largest Class Cycle : " + getClassName (cycle .getCycleName ()) + "</h2>\n " );
590+ stringBuilder .append ("<a id= \" CYCLEMAP \" ><h2 align= \" center \" >Largest Class Cycle : "
591+ + getClassName (cycle .getCycleName ()) + "</h2></a >\n " );
584592 stringBuilder .append (
585593 "<h3 align=\" center\" >Limiting number of cycles displayed to 1 to keep page load time fast</h3>\n " );
586594 stringBuilder .append (renderCycleVisuals (cycle , repoUrl , codebaseGraphDTO ));
0 commit comments