Skip to content

Commit 21f4668

Browse files
authored
NEW @W-20028078@ Updated HTML template (#377)
1 parent be74ddc commit 21f4668

File tree

6 files changed

+47
-15
lines changed

6 files changed

+47
-15
lines changed

packages/code-analyzer-core/output-templates/html-template-0.0.13.txt renamed to packages/code-analyzer-core/output-templates/html-template-0.0.14.txt

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,16 @@
237237
);
238238
}
239239
getLocation(violation) {
240-
const position = this.getPosition(violation);
241-
return `<ul class="locations"><li><span class="file">${position ? `${violation.file} (${position})` : violation.file}</span></li></ul>`;
240+
var _a, _b;
241+
const position = this.getPosition(violation),
242+
location = position
243+
? `${violation.file} (${position})`
244+
: violation.file,
245+
comment =
246+
(_b = (_a = violation.locations) == null ? void 0 : _a[0]) == null
247+
? void 0
248+
: _b.comment;
249+
return `<ul class="locations"><li><span class="file">${location}</span>${comment ? `<span class="comment">${comment}</span>` : ""}</li></ul>`;
242250
}
243251
getLocationsList(violation) {
244252
var _a;
@@ -1793,7 +1801,7 @@
17931801
Generated by Code Analyzer from path:
17941802

17951803
<!-- START OF RUNDIR -->
1796-
<span class="rundir">{{###RUNDIR###}}</span>
1804+
<code class="rundir">{{###RUNDIR###}}</code>
17971805
<!-- END OF RUNDIR -->
17981806

17991807
</p>

packages/code-analyzer-core/package.json

Lines changed: 2 additions & 2 deletions
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.39.0",
4+
"version": "0.40.0-SNAPSHOT",
55
"author": "The Salesforce Code Analyzer Team",
66
"license": "BSD-3-Clause",
77
"homepage": "https://developer.salesforce.com/docs/platform/salesforce-code-analyzer/overview",
@@ -72,4 +72,4 @@
7272
"!src/index.ts"
7373
]
7474
}
75-
}
75+
}

packages/code-analyzer-core/src/output-formats/results/html-run-results-format.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
toJsonResultsOutput
99
} from "./json-run-results-format";
1010

11-
const HTML_TEMPLATE_VERSION: string = '0.0.13';
11+
const HTML_TEMPLATE_VERSION: string = '0.0.14';
1212
const HTML_TEMPLATE_FILE: string = path.resolve(__dirname, '..', '..', '..', 'output-templates', `html-template-${HTML_TEMPLATE_VERSION}.txt`);
1313

1414
/**

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,16 @@
237237
);
238238
}
239239
getLocation(violation) {
240-
const position = this.getPosition(violation);
241-
return `<ul class="locations"><li><span class="file">${position ? `${violation.file} (${position})` : violation.file}</span></li></ul>`;
240+
var _a, _b;
241+
const position = this.getPosition(violation),
242+
location = position
243+
? `${violation.file} (${position})`
244+
: violation.file,
245+
comment =
246+
(_b = (_a = violation.locations) == null ? void 0 : _a[0]) == null
247+
? void 0
248+
: _b.comment;
249+
return `<ul class="locations"><li><span class="file">${location}</span>${comment ? `<span class="comment">${comment}</span>` : ""}</li></ul>`;
242250
}
243251
getLocationsList(violation) {
244252
var _a;
@@ -1793,7 +1801,7 @@ <h4 aria-hidden="true">Group</h4>
17931801
Generated by Code Analyzer from path:
17941802

17951803
<!-- START OF RUNDIR -->
1796-
<span class="rundir">{{###RUNDIR###}}</span>
1804+
<code class="rundir">{{###RUNDIR###}}</code>
17971805
<!-- END OF RUNDIR -->
17981806

17991807
</p>

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,16 @@
237237
);
238238
}
239239
getLocation(violation) {
240-
const position = this.getPosition(violation);
241-
return `<ul class="locations"><li><span class="file">${position ? `${violation.file} (${position})` : violation.file}</span></li></ul>`;
240+
var _a, _b;
241+
const position = this.getPosition(violation),
242+
location = position
243+
? `${violation.file} (${position})`
244+
: violation.file,
245+
comment =
246+
(_b = (_a = violation.locations) == null ? void 0 : _a[0]) == null
247+
? void 0
248+
: _b.comment;
249+
return `<ul class="locations"><li><span class="file">${location}</span>${comment ? `<span class="comment">${comment}</span>` : ""}</li></ul>`;
242250
}
243251
getLocationsList(violation) {
244252
var _a;
@@ -1793,7 +1801,7 @@ <h4 aria-hidden="true">Group</h4>
17931801
Generated by Code Analyzer from path:
17941802

17951803
<!-- START OF RUNDIR -->
1796-
<span class="rundir">{{###RUNDIR###}}</span>
1804+
<code class="rundir">{{###RUNDIR###}}</code>
17971805
<!-- END OF RUNDIR -->
17981806

17991807
</p>

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,16 @@
237237
);
238238
}
239239
getLocation(violation) {
240-
const position = this.getPosition(violation);
241-
return `<ul class="locations"><li><span class="file">${position ? `${violation.file} (${position})` : violation.file}</span></li></ul>`;
240+
var _a, _b;
241+
const position = this.getPosition(violation),
242+
location = position
243+
? `${violation.file} (${position})`
244+
: violation.file,
245+
comment =
246+
(_b = (_a = violation.locations) == null ? void 0 : _a[0]) == null
247+
? void 0
248+
: _b.comment;
249+
return `<ul class="locations"><li><span class="file">${location}</span>${comment ? `<span class="comment">${comment}</span>` : ""}</li></ul>`;
242250
}
243251
getLocationsList(violation) {
244252
var _a;
@@ -1793,7 +1801,7 @@ <h4 aria-hidden="true">Group</h4>
17931801
Generated by Code Analyzer from path:
17941802

17951803
<!-- START OF RUNDIR -->
1796-
<span class="rundir">{{###RUNDIR###}}</span>
1804+
<code class="rundir">{{###RUNDIR###}}</code>
17971805
<!-- END OF RUNDIR -->
17981806

17991807
</p>

0 commit comments

Comments
 (0)