@@ -51,38 +51,54 @@ private StringBuilder summarize() {
5151 sum .append (bold ("SonarQube" )).append (" " )
5252 .append ("analysis reported " )
5353 .append (bold (String .valueOf (totalIssues )))
54+ .append (" issue" )
5455 .append (totalIssues > 1 ? "s" : "" )
5556 .append ("\n " );
5657 // Blocker
57- sum .append (" - " )
58- .append (String .valueOf (numberOfIssues (Severity .BLOCKER )))
59- .append (" Blocker issue" )
60- .append (numberOfIssues (Severity .BLOCKER ) > 1 ? "s" : "" )
61- .append ("(" ).append (remarkupUtils .icon (Severity .BLOCKER )).append (")\n " );
58+ int blockerIssues = numberOfIssues (Severity .BLOCKER );
59+ if (blockerIssues > 0 ) {
60+ sum .append (" - " )
61+ .append (String .valueOf (blockerIssues ))
62+ .append (" Blocker issue" )
63+ .append (blockerIssues > 1 ? "s" : "" )
64+ .append (" (" ).append (remarkupUtils .icon (Severity .BLOCKER )).append (")\n " );
65+ }
6266 // Critical
63- sum .append (" - " )
64- .append (String .valueOf (numberOfIssues (Severity .CRITICAL )))
65- .append (" Critical issue" )
66- .append (numberOfIssues (Severity .CRITICAL ) > 1 ? "s" : "" )
67- .append ("(" ).append (remarkupUtils .icon (Severity .CRITICAL )).append (")\n " );
67+ int criticalIssues = numberOfIssues (Severity .CRITICAL );
68+ if (criticalIssues > 0 ) {
69+ sum .append (" - " )
70+ .append (String .valueOf (criticalIssues ))
71+ .append (" Critical issue" )
72+ .append (criticalIssues > 1 ? "s" : "" )
73+ .append (" (" ).append (remarkupUtils .icon (Severity .CRITICAL )).append (")\n " );
74+ }
6875 // Major
69- sum .append (" - " )
70- .append (String .valueOf (numberOfIssues (Severity .MAJOR )))
71- .append (" Major issue" )
72- .append (numberOfIssues (Severity .MAJOR ) > 1 ? "s" : "" )
73- .append ("(" ).append (remarkupUtils .icon (Severity .MAJOR )).append (")\n " );
76+ int majorIssues = numberOfIssues (Severity .MAJOR );
77+ if (majorIssues > 0 ) {
78+ sum .append (" - " )
79+ .append (String .valueOf (majorIssues ))
80+ .append (" Major issue" )
81+ .append (majorIssues > 1 ? "s" : "" )
82+ .append (" (" ).append (remarkupUtils .icon (Severity .MAJOR )).append (")\n " );
83+ }
7484 // Minor
75- sum .append (" - " )
76- .append (String .valueOf (numberOfIssues (Severity .MINOR )))
77- .append (" Minor issue" )
78- .append (numberOfIssues (Severity .MINOR ) > 1 ? "s" : "" )
79- .append ("(" ).append (remarkupUtils .icon (Severity .MINOR )).append (")\n " );
85+ int minorIssues = numberOfIssues (Severity .MINOR );
86+ if (minorIssues > 0 ) {
87+ sum .append (" - " )
88+ .append (String .valueOf (minorIssues ))
89+ .append (" Minor issue" )
90+ .append (minorIssues > 1 ? "s" : "" )
91+ .append (" (" ).append (remarkupUtils .icon (Severity .MINOR )).append (")\n " );
92+ }
8093 // Info
81- sum .append (" - " )
82- .append (String .valueOf (numberOfIssues (Severity .INFO )))
83- .append (" Info issue" )
84- .append (numberOfIssues (Severity .INFO ) > 1 ? "s" : "" )
85- .append ("(" ).append (remarkupUtils .icon (Severity .INFO )).append (")\n " );
94+ int infoIssues = numberOfIssues (Severity .INFO );
95+ if (infoIssues > 0 ) {
96+ sum .append (" - " )
97+ .append (String .valueOf (infoIssues ))
98+ .append (" Info issue" )
99+ .append (infoIssues > 1 ? "s" : "" )
100+ .append (" (" ).append (remarkupUtils .icon (Severity .INFO )).append (")\n " );
101+ }
86102 } else {
87103 sum .append ("You are great developer.\n " )
88104 .append (bold ("SonarQube" ))
0 commit comments