Skip to content

Commit 1e1a692

Browse files
authored
Merge pull request github#12686 from erik-krogh/backtick-parse-error
JS: add backticks around the concrete parse error
2 parents cc841a6 + 4b3a419 commit 1e1a692

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

javascript/extractor/src/com/semmle/js/extractor/AutoBuild.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1236,7 +1236,7 @@ private void doExtract(FileExtractor extractor, Path file, ExtractorState state)
12361236
if (!extractor.getConfig().isExterns()) seenFiles = true;
12371237
List<ParseError> errors = loc == null ? Collections.emptyList() : loc.getParseErrors();
12381238
for (ParseError err : errors) {
1239-
String msg = "A parse error occurred: " + StringUtil.escapeMarkdown(err.getMessage())
1239+
String msg = "A parse error occurred: " + StringUtil.quoteWithBackticks(err.getMessage().trim())
12401240
+ ". Check the syntax of the file. If the file is invalid, correct the error or [exclude](https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/customizing-code-scanning) the file from analysis.";
12411241
// file, relative to the source root
12421242
String relativeFilePath = null;

javascript/ql/integration-tests/all-platforms/diagnostics/syntax-error/diagnostics.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"startColumn": 4,
77
"startLine": 1
88
},
9-
"markdownMessage": "A parse error occurred: Unexpected token. Check the syntax of the file. If the file is invalid, correct the error or [exclude](https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/customizing-code-scanning) the file from analysis.",
9+
"markdownMessage": "A parse error occurred: `Unexpected token`. Check the syntax of the file. If the file is invalid, correct the error or [exclude](https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/customizing-code-scanning) the file from analysis.",
1010
"severity": "warning",
1111
"source": {
1212
"extractorName": "javascript",

0 commit comments

Comments
 (0)