Skip to content

Commit 9521b67

Browse files
committed
Fix highlighting of violation line
1 parent 27a3b49 commit 9521b67

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

resources/js/code-snippets.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
return prefix + number;
2727
}
2828

29-
function fetchSnippet(document, container, url, line, weburl) {
29+
function fetchSnippet(document, container, url, violationLineNumber, weburl) {
3030
var weburl, requestUrl, oReq;
3131

3232
requestUrl = url.replace(/github.com/, "raw.githubusercontent.com");
@@ -40,7 +40,7 @@
4040
container.innerHTML = '<p><a href="' + weburl + '" target="_blank" rel="noopener noreferrer">' + weburl + '</a></p>';
4141

4242
lines = this.responseText.split(/\r\n|\n/);
43-
start = line - contextLines;
43+
start = violationLineNumber - contextLines;
4444
if (start > 0) {
4545
lines.splice(0, start); // remove lines before
4646
}
@@ -51,7 +51,7 @@
5151
lines.forEach(line => {
5252
start++;
5353
let lineElt = document.createElement("code");
54-
if (start === line) {
54+
if (start === violationLineNumber) {
5555
lineElt.classList.add("highlight");
5656
}
5757
// createTextNode escapes special chars

0 commit comments

Comments
 (0)