Merge pull requets #4750 from 219sansim:fix_flaky_SummaryHTMLRenderer

[core] Fix flaky SummaryHTMLRenderer #4750
This commit is contained in:
Andreas Dangel committed 2023-11-23 19:16:11 +01:00
commit f030d7f8d7
5 files changed
+131 -117

No files matched your search

+9
View File
@@ -7296,6 +7296,15 @@
"contributions": [
"doc"
]
},
{
"login": "219sansim",
"name": "219sansim",
"avatar_url": "https://avatars.githubusercontent.com/u/108684604?v=4",
"profile": "https://github.com/219sansim",
"contributions": [
"code"
]
}
],
"contributorsPerLine": 7,
File diff suppressed because it is too large. Load diff
+4
View File
@@ -89,6 +89,7 @@ in the Migration Guide.
* [#4723](https://github.com/pmd/pmd/issues/4723): \[cli] Launch fails for "bash pmd"
* core
* [#1027](https://github.com/pmd/pmd/issues/1027): \[core] Apply the new PropertyDescriptor<Pattern> type where applicable
* [#4750](https://github.com/pmd/pmd/pull/4750): \[core] Fix flaky SummaryHTMLRenderer
* doc
* [#3175](https://github.com/pmd/pmd/issues/3175): \[doc] Document language module features
* [#4659](https://github.com/pmd/pmd/pull/4659): \[doc] Improve ant documentation
@@ -132,6 +133,7 @@ The following previously deprecated classes have been removed:
* [#4677](https://github.com/pmd/pmd/pull/4677): \[apex] Add new rule: OperationWithHighCostInLoop - [Thomas Prouvot](https://github.com/tprouvot) (@tprouvot)
* [#4719](https://github.com/pmd/pmd/pull/4719): \[java] UnnecessaryCaseChange: example doc toUpperCase() should compare to a capitalized string - [ciufudean](https://github.com/ciufudean) (@ciufudean)
* [#4738](https://github.com/pmd/pmd/pull/4738): \[doc] Added reference to the PMD extension for bld - [Erik C. Thauvin](https://github.com/ethauvin) (@ethauvin)
* [#4750](https://github.com/pmd/pmd/pull/4750): \[core] Fix flaky SummaryHTMLRenderer - [219sansim](https://github.com/219sansim) (@219sansim)
### 🚀 Major Features and Enhancements
@@ -524,6 +526,7 @@ See also [Detailed Release Notes for PMD 7]({{ baseurl }}pmd_release_notes_pmd7.
* [#4454](https://github.com/pmd/pmd/issues/4454): \[core] "Unknown option: '-min'" but is referenced in documentation
* [#4611](https://github.com/pmd/pmd/pull/4611): \[core] Fix loading language properties from env vars
* [#4621](https://github.com/pmd/pmd/issues/4621): \[core] Make `ClasspathClassLoader::getResource` child first
* [#4750](https://github.com/pmd/pmd/pull/4750): \[core] Fix flaky SummaryHTMLRenderer
* cli
* [#2234](https://github.com/pmd/pmd/issues/2234): \[core] Consolidate PMD CLI into a single command
* [#3828](https://github.com/pmd/pmd/issues/3828): \[core] Progress reporting
@@ -788,6 +791,7 @@ Language specific fixes:
* [#4677](https://github.com/pmd/pmd/pull/4677): \[apex] Add new rule: OperationWithHighCostInLoop - [Thomas Prouvot](https://github.com/tprouvot) (@tprouvot)
* [#4719](https://github.com/pmd/pmd/pull/4719): \[java] UnnecessaryCaseChange: example doc toUpperCase() should compare to a capitalized string - [ciufudean](https://github.com/ciufudean) (@ciufudean)
* [#4738](https://github.com/pmd/pmd/pull/4738): \[doc] Added reference to the PMD extension for bld - [Erik C. Thauvin](https://github.com/ethauvin) (@ethauvin)
* [#4750](https://github.com/pmd/pmd/pull/4750): \[core] Fix flaky SummaryHTMLRenderer - [219sansim](https://github.com/219sansim) (@219sansim)
### 📈 Stats
* 5007 commits
@@ -5,7 +5,7 @@
package net.sourceforge.pmd.renderers;
import java.io.IOException;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
@@ -74,7 +74,7 @@ public class SummaryHTMLRenderer extends AbstractAccumulatingRenderer {
}
private static Map<String, MutableInt> getSummary(Report report) {
Map<String, MutableInt> summary = new HashMap<>();
Map<String, MutableInt> summary = new LinkedHashMap<>();
for (RuleViolation rv : report.getViolations()) {
String name = rv.getRule().getName();
MutableInt count = summary.get(name);
@@ -69,8 +69,8 @@ class SummaryHTMLRendererTest extends AbstractRendererTest {
return "<html><head><title>PMD</title></head><body>" + EOL + "<center><h2>Summary</h2></center>" + EOL
+ "<table align=\"center\" cellspacing=\"0\" cellpadding=\"3\">" + EOL
+ "<tr><th>Rule name</th><th>Number of violations</th></tr>" + EOL
+ "<tr><td>Boo</td><td align=center>1</td></tr>" + EOL
+ "<tr><td>Foo</td><td align=center>1</td></tr>" + EOL + "</table>" + EOL
+ "<tr><td>Foo</td><td align=center>1</td></tr>" + EOL
+ "<tr><td>Boo</td><td align=center>1</td></tr>" + EOL + "</table>" + EOL
+ "<center><h2>Detail</h2></center><table align=\"center\" cellspacing=\"0\" cellpadding=\"3\"><tr>"
+ EOL
+ "<center><h3>PMD report</h3></center><center><h3>Problems found</h3></center><table align=\"center\" cellspacing=\"0\" cellpadding=\"3\"><tr>"