From 146fec75d8e10ce6c29e1b2aab1c446c8ccec379 Mon Sep 17 00:00:00 2001 From: WebFreak001 Date: Thu, 29 Jun 2023 16:45:11 +0200 Subject: [PATCH] add index and endIndex to JSON formats --- src/dscanner/analysis/run.d | 2 ++ src/dscanner/reports.d | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/src/dscanner/analysis/run.d b/src/dscanner/analysis/run.d index 407757c..11b2fca 100644 --- a/src/dscanner/analysis/run.d +++ b/src/dscanner/analysis/run.d @@ -157,8 +157,10 @@ void writeJSON(Message message) writeln(` "fileName": "`, message.fileName.replace("\\", "\\\\").replace(`"`, `\"`), `",`); writeln(` "line": `, message.startLine, `,`); writeln(` "column": `, message.startColumn, `,`); + writeln(` "index": `, message.startIndex, `,`); writeln(` "endLine": `, message.endLine, `,`); writeln(` "endColumn": `, message.endColumn, `,`); + writeln(` "endIndex": `, message.endIndex, `,`); writeln(` "message": "`, message.message.replace("\\", "\\\\").replace(`"`, `\"`), `",`); if (message.supplemental.length) { diff --git a/src/dscanner/reports.d b/src/dscanner/reports.d index a2a21b9..a54bac3 100644 --- a/src/dscanner/reports.d +++ b/src/dscanner/reports.d @@ -61,8 +61,10 @@ class DScannerJsonReporter "fileName": JSONValue(issue.message.fileName), "line": JSONValue(issue.message.startLine), "column": JSONValue(issue.message.startColumn), + "index": JSONValue(issue.message.startIndex), "endLine": JSONValue(issue.message.endLine), "endColumn": JSONValue(issue.message.endColumn), + "endIndex": JSONValue(issue.message.endIndex), "message": JSONValue(issue.message.message), "type": JSONValue(issue.type), "supplemental": JSONValue( @@ -71,8 +73,10 @@ class DScannerJsonReporter "fileName": JSONValue(a.fileName), "line": JSONValue(a.startLine), "column": JSONValue(a.startColumn), + "index": JSONValue(a.startIndex), "endLine": JSONValue(a.endLine), "endColumn": JSONValue(a.endColumn), + "endIndex": JSONValue(a.endIndex), "message": JSONValue(a.message), ]) ).array