Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

D/w 17100347 #127

Draft
wants to merge 3 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
!(relList && relList.supports && relList.supports("modulepreload"))
) {
for (const link of document.querySelectorAll(
'link[rel="modulepreload"]'
'link[rel="modulepreload"]',
))
processPreload(link);
new MutationObserver((mutations) => {
Expand Down Expand Up @@ -71,7 +71,7 @@
.reduce(
(acc, part) =>
acc && void 0 !== acc[part] ? acc[part] : defaultValue,
obj
obj,
);
}
processViolations(data2) {
Expand Down Expand Up @@ -157,6 +157,9 @@
groupByEngine(data2) {
return this.groupBy(data2, "engine");
}
groupByRule(data2) {
return this.groupBy(data2, "rule");
}
}
class View {
constructor(model) {
Expand Down Expand Up @@ -322,14 +325,20 @@
this.model.groupByEngine(data2),
false,
)
: data2.forEach((violation) => this.populateRow(violation)),
: "rule" === groupBy
? this.populateGroupedTable(
this.model.groupByRule(data2),
false,
)
: data2.forEach((violation) => this.populateRow(violation)),
this.updateSummary(data2);
}
populateGroupedTable(groupedData, isSeverity) {
groupedData.forEach((violations, groupKey) => {
(this.tableBody.insertRow().innerHTML = `<td colspan="8" class="group">
${isSeverity ? `<span class="dot sev${this.getSeverityValue(parseInt(groupKey))}"></span>` : ""}
${isSeverity ? this.getSeverityText(parseInt(groupKey)) : groupKey}
<span class="count">(${violations.length})</span>
</td>`),
violations.forEach((violation) => this.populateRow(violation));
});
Expand Down Expand Up @@ -490,6 +499,7 @@
n: () => this.handleGroupBy("file"),
e: () => this.handleGroupBy("engine"),
s: () => this.handleGroupBy("severity"),
r: () => this.handleGroupBy("rule"),
u: () => this.handleGroupBy(""),
escape: () => this.handleEscapeKey(),
arrowup: () => this.handleArrowKey(-1),
Expand Down Expand Up @@ -992,6 +1002,10 @@
white-space: nowrap;
}

table .count {
color: var(--color-shade-7);
}

table .line,
table .column {
min-width: 80px;
Expand Down Expand Up @@ -1415,7 +1429,10 @@
<strong>Code Analyzer Report</strong> – {{###TIMESTAMP###}}
</h2>
<p class="help" aria-label="documentation">
<a href="https://developer.salesforce.com/docs/platform/salesforce-code-analyzer/overview">Developer Docs</a>
<a
href="https://developer.salesforce.com/docs/platform/salesforce-code-analyzer/overview"
>Developer Docs</a
>
</p>
</header>

Expand Down Expand Up @@ -1479,12 +1496,14 @@

<div class="view">
<h3>Group</h3>

<select id="groupBy">
<option value="">Ungrouped</option>
<option disabled>───</option>
<option value="engine">Engine</option>
<option value="file">Filename</option>
<option value="rule">Rule</option>
<option value="severity">Severity</option>
<option value="engine">Engine</option>
</select>
</div>
</div>
Expand All @@ -1502,6 +1521,7 @@
<th data-sort="column" class="column">Column</th>
</tr>
</thead>

<tbody></tbody>
</table>
</main>
Expand Down
2 changes: 1 addition & 1 deletion packages/code-analyzer-core/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@salesforce/code-analyzer-core",
"description": "Core Package for the Salesforce Code Analyzer",
"version": "0.16.0",
"version": "0.16.1",
"author": "The Salesforce Code Analyzer Team",
"license": "BSD-3-Clause",
"homepage": "https://developer.salesforce.com/docs/platform/salesforce-code-analyzer/overview",
Expand Down
1 change: 1 addition & 0 deletions packages/code-analyzer-core/src/output-format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import * as sarif from "sarif";
export enum OutputFormat {
CSV = "CSV",
JSON = "JSON",
JUNIT = "JUNIT",
XML = "XML",
HTML = "HTML",
SARIF = "SARIF"
Expand Down
4 changes: 4 additions & 0 deletions packages/code-analyzer-core/test/output-format.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ describe("Tests for the JSON output format", () => {
});
});

describe("Tests for the JUNIT-XML output format", () => {
it("When an empty result is provided,")
});

describe("Tests for the XML output format", () => {
it("When an empty result is provided, we create a xml text with summary having zeros", () => {
const results: RunResults = new RunResultsImpl();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
!(relList && relList.supports && relList.supports("modulepreload"))
) {
for (const link of document.querySelectorAll(
'link[rel="modulepreload"]'
'link[rel="modulepreload"]',
))
processPreload(link);
new MutationObserver((mutations) => {
Expand Down Expand Up @@ -71,7 +71,7 @@
.reduce(
(acc, part) =>
acc && void 0 !== acc[part] ? acc[part] : defaultValue,
obj
obj,
);
}
processViolations(data2) {
Expand Down Expand Up @@ -157,6 +157,9 @@
groupByEngine(data2) {
return this.groupBy(data2, "engine");
}
groupByRule(data2) {
return this.groupBy(data2, "rule");
}
}
class View {
constructor(model) {
Expand Down Expand Up @@ -322,14 +325,20 @@
this.model.groupByEngine(data2),
false,
)
: data2.forEach((violation) => this.populateRow(violation)),
: "rule" === groupBy
? this.populateGroupedTable(
this.model.groupByRule(data2),
false,
)
: data2.forEach((violation) => this.populateRow(violation)),
this.updateSummary(data2);
}
populateGroupedTable(groupedData, isSeverity) {
groupedData.forEach((violations, groupKey) => {
(this.tableBody.insertRow().innerHTML = `<td colspan="8" class="group">
${isSeverity ? `<span class="dot sev${this.getSeverityValue(parseInt(groupKey))}"></span>` : ""}
${isSeverity ? this.getSeverityText(parseInt(groupKey)) : groupKey}
<span class="count">(${violations.length})</span>
</td>`),
violations.forEach((violation) => this.populateRow(violation));
});
Expand Down Expand Up @@ -490,6 +499,7 @@
n: () => this.handleGroupBy("file"),
e: () => this.handleGroupBy("engine"),
s: () => this.handleGroupBy("severity"),
r: () => this.handleGroupBy("rule"),
u: () => this.handleGroupBy(""),
escape: () => this.handleEscapeKey(),
arrowup: () => this.handleArrowKey(-1),
Expand Down Expand Up @@ -992,6 +1002,10 @@
white-space: nowrap;
}

table .count {
color: var(--color-shade-7);
}

table .line,
table .column {
min-width: 80px;
Expand Down Expand Up @@ -1415,7 +1429,10 @@ <h2 class="title">
<strong>Code Analyzer Report</strong> – Jul 3, 2024, 9:14 AM
</h2>
<p class="help" aria-label="documentation">
<a href="https://developer.salesforce.com/docs/platform/salesforce-code-analyzer/overview">Developer Docs</a>
<a
href="https://developer.salesforce.com/docs/platform/salesforce-code-analyzer/overview"
>Developer Docs</a
>
</p>
</header>

Expand Down Expand Up @@ -1479,12 +1496,14 @@ <h3>Filter</h3>

<div class="view">
<h3>Group</h3>

<select id="groupBy">
<option value="">Ungrouped</option>
<option disabled>───</option>
<option value="engine">Engine</option>
<option value="file">Filename</option>
<option value="rule">Rule</option>
<option value="severity">Severity</option>
<option value="engine">Engine</option>
</select>
</div>
</div>
Expand All @@ -1502,6 +1521,7 @@ <h3>Group</h3>
<th data-sort="column" class="column">Column</th>
</tr>
</thead>

<tbody></tbody>
</table>
</main>
Expand Down
Loading
Loading