Skip to content

Commit 4c244eb

Browse files
authored
NEW @W-17042378@ Supplemental PR with HTML updates (#125)
1 parent a5588c6 commit 4c244eb

File tree

11 files changed

+121
-41
lines changed

11 files changed

+121
-41
lines changed

package-lock.json

Lines changed: 15 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/code-analyzer-core/output-templates/html-template-0.0.1.txt

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
!(relList && relList.supports && relList.supports("modulepreload"))
1616
) {
1717
for (const link of document.querySelectorAll(
18-
'link[rel="modulepreload"]'
18+
'link[rel="modulepreload"]',
1919
))
2020
processPreload(link);
2121
new MutationObserver((mutations) => {
@@ -71,7 +71,7 @@
7171
.reduce(
7272
(acc, part) =>
7373
acc && void 0 !== acc[part] ? acc[part] : defaultValue,
74-
obj
74+
obj,
7575
);
7676
}
7777
processViolations(data2) {
@@ -157,6 +157,9 @@
157157
groupByEngine(data2) {
158158
return this.groupBy(data2, "engine");
159159
}
160+
groupByRule(data2) {
161+
return this.groupBy(data2, "rule");
162+
}
160163
}
161164
class View {
162165
constructor(model) {
@@ -322,14 +325,20 @@
322325
this.model.groupByEngine(data2),
323326
false,
324327
)
325-
: data2.forEach((violation) => this.populateRow(violation)),
328+
: "rule" === groupBy
329+
? this.populateGroupedTable(
330+
this.model.groupByRule(data2),
331+
false,
332+
)
333+
: data2.forEach((violation) => this.populateRow(violation)),
326334
this.updateSummary(data2);
327335
}
328336
populateGroupedTable(groupedData, isSeverity) {
329337
groupedData.forEach((violations, groupKey) => {
330338
(this.tableBody.insertRow().innerHTML = `<td colspan="8" class="group">
331339
${isSeverity ? `<span class="dot sev${this.getSeverityValue(parseInt(groupKey))}"></span>` : ""}
332340
${isSeverity ? this.getSeverityText(parseInt(groupKey)) : groupKey}
341+
<span class="count">(${violations.length})</span>
333342
</td>`),
334343
violations.forEach((violation) => this.populateRow(violation));
335344
});
@@ -490,6 +499,7 @@
490499
n: () => this.handleGroupBy("file"),
491500
e: () => this.handleGroupBy("engine"),
492501
s: () => this.handleGroupBy("severity"),
502+
r: () => this.handleGroupBy("rule"),
493503
u: () => this.handleGroupBy(""),
494504
escape: () => this.handleEscapeKey(),
495505
arrowup: () => this.handleArrowKey(-1),
@@ -992,6 +1002,10 @@
9921002
white-space: nowrap;
9931003
}
9941004

1005+
table .count {
1006+
color: var(--color-shade-7);
1007+
}
1008+
9951009
table .line,
9961010
table .column {
9971011
min-width: 80px;
@@ -1415,7 +1429,10 @@
14151429
<strong>Code Analyzer Report</strong> – {{###TIMESTAMP###}}
14161430
</h2>
14171431
<p class="help" aria-label="documentation">
1418-
<a href="https://developer.salesforce.com/docs/platform/salesforce-code-analyzer/overview">Developer Docs</a>
1432+
<a
1433+
href="https://developer.salesforce.com/docs/platform/salesforce-code-analyzer/overview"
1434+
>Developer Docs</a
1435+
>
14191436
</p>
14201437
</header>
14211438

@@ -1479,12 +1496,14 @@
14791496

14801497
<div class="view">
14811498
<h3>Group</h3>
1499+
14821500
<select id="groupBy">
14831501
<option value="">Ungrouped</option>
14841502
<option disabled>───</option>
1503+
<option value="engine">Engine</option>
14851504
<option value="file">Filename</option>
1505+
<option value="rule">Rule</option>
14861506
<option value="severity">Severity</option>
1487-
<option value="engine">Engine</option>
14881507
</select>
14891508
</div>
14901509
</div>
@@ -1502,6 +1521,7 @@
15021521
<th data-sort="column" class="column">Column</th>
15031522
</tr>
15041523
</thead>
1524+
15051525
<tbody></tbody>
15061526
</table>
15071527
</main>

packages/code-analyzer-core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@salesforce/code-analyzer-core",
33
"description": "Core Package for the Salesforce Code Analyzer",
4-
"version": "0.16.0",
4+
"version": "0.16.1",
55
"author": "The Salesforce Code Analyzer Team",
66
"license": "BSD-3-Clause",
77
"homepage": "https://developer.salesforce.com/docs/platform/salesforce-code-analyzer/overview",

packages/code-analyzer-core/test/test-data/expectedOutputFiles/multipleViolations.goldfile.html

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
!(relList && relList.supports && relList.supports("modulepreload"))
1616
) {
1717
for (const link of document.querySelectorAll(
18-
'link[rel="modulepreload"]'
18+
'link[rel="modulepreload"]',
1919
))
2020
processPreload(link);
2121
new MutationObserver((mutations) => {
@@ -71,7 +71,7 @@
7171
.reduce(
7272
(acc, part) =>
7373
acc && void 0 !== acc[part] ? acc[part] : defaultValue,
74-
obj
74+
obj,
7575
);
7676
}
7777
processViolations(data2) {
@@ -157,6 +157,9 @@
157157
groupByEngine(data2) {
158158
return this.groupBy(data2, "engine");
159159
}
160+
groupByRule(data2) {
161+
return this.groupBy(data2, "rule");
162+
}
160163
}
161164
class View {
162165
constructor(model) {
@@ -322,14 +325,20 @@
322325
this.model.groupByEngine(data2),
323326
false,
324327
)
325-
: data2.forEach((violation) => this.populateRow(violation)),
328+
: "rule" === groupBy
329+
? this.populateGroupedTable(
330+
this.model.groupByRule(data2),
331+
false,
332+
)
333+
: data2.forEach((violation) => this.populateRow(violation)),
326334
this.updateSummary(data2);
327335
}
328336
populateGroupedTable(groupedData, isSeverity) {
329337
groupedData.forEach((violations, groupKey) => {
330338
(this.tableBody.insertRow().innerHTML = `<td colspan="8" class="group">
331339
${isSeverity ? `<span class="dot sev${this.getSeverityValue(parseInt(groupKey))}"></span>` : ""}
332340
${isSeverity ? this.getSeverityText(parseInt(groupKey)) : groupKey}
341+
<span class="count">(${violations.length})</span>
333342
</td>`),
334343
violations.forEach((violation) => this.populateRow(violation));
335344
});
@@ -490,6 +499,7 @@
490499
n: () => this.handleGroupBy("file"),
491500
e: () => this.handleGroupBy("engine"),
492501
s: () => this.handleGroupBy("severity"),
502+
r: () => this.handleGroupBy("rule"),
493503
u: () => this.handleGroupBy(""),
494504
escape: () => this.handleEscapeKey(),
495505
arrowup: () => this.handleArrowKey(-1),
@@ -992,6 +1002,10 @@
9921002
white-space: nowrap;
9931003
}
9941004

1005+
table .count {
1006+
color: var(--color-shade-7);
1007+
}
1008+
9951009
table .line,
9961010
table .column {
9971011
min-width: 80px;
@@ -1415,7 +1429,10 @@ <h2 class="title">
14151429
<strong>Code Analyzer Report</strong> – Jul 3, 2024, 9:14 AM
14161430
</h2>
14171431
<p class="help" aria-label="documentation">
1418-
<a href="https://developer.salesforce.com/docs/platform/salesforce-code-analyzer/overview">Developer Docs</a>
1432+
<a
1433+
href="https://developer.salesforce.com/docs/platform/salesforce-code-analyzer/overview"
1434+
>Developer Docs</a
1435+
>
14191436
</p>
14201437
</header>
14211438

@@ -1479,12 +1496,14 @@ <h3>Filter</h3>
14791496

14801497
<div class="view">
14811498
<h3>Group</h3>
1499+
14821500
<select id="groupBy">
14831501
<option value="">Ungrouped</option>
14841502
<option disabled>───</option>
1503+
<option value="engine">Engine</option>
14851504
<option value="file">Filename</option>
1505+
<option value="rule">Rule</option>
14861506
<option value="severity">Severity</option>
1487-
<option value="engine">Engine</option>
14881507
</select>
14891508
</div>
14901509
</div>
@@ -1502,6 +1521,7 @@ <h3>Group</h3>
15021521
<th data-sort="column" class="column">Column</th>
15031522
</tr>
15041523
</thead>
1524+
15051525
<tbody></tbody>
15061526
</table>
15071527
</main>

0 commit comments

Comments
 (0)