Skip to content

Commit e5e20ab

Browse files
committed
add backticks around the concrete parse error
1 parent 32bab0b commit e5e20ab

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,8 +1236,8 @@ 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())
1240-
+ ". 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.";
1239+
String msg = "A parse error occurred: `" + StringUtil.escapeMarkdown(err.getMessage()).trim()
1240+
+ "`. 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;
12431243
if (file.startsWith(LGTM_SRC)) {

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)