Skip to content

Commit 358d197

Browse files
committed
Refactor source type into DiagnosticSource
1 parent 8bc3738 commit 358d197

1 file changed

Lines changed: 20 additions & 16 deletions

File tree

‎src/diagnostics.ts‎

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,30 @@ import { getCodeQLDatabasePath } from "./util";
1212
*/
1313
export type DiagnosticTag = "internal-error";
1414

15+
/** Represents information about the origin of a diagnostic. */
16+
export interface DiagnosticSource {
17+
/**
18+
* An identifier under which it makes sense to group this diagnostic message.
19+
* This is used to build the SARIF reporting descriptor object.
20+
*/
21+
id: string;
22+
/** Display name for the ID. This is used to build the SARIF reporting descriptor object. */
23+
name: string;
24+
/**
25+
* Name of the CodeQL extractor. This is used to identify which tool component the reporting
26+
* descriptor object should be nested under in SARIF.
27+
*/
28+
extractorName?: string;
29+
/** An array of tags for the diagnostic. */
30+
tags?: DiagnosticTag[];
31+
}
32+
1533
/** Represents a diagnostic message for the tool status page, etc. */
1634
export interface DiagnosticMessage {
1735
/** ISO 8601 timestamp */
1836
timestamp: string;
19-
source: {
20-
/**
21-
* An identifier under which it makes sense to group this diagnostic message.
22-
* This is used to build the SARIF reporting descriptor object.
23-
*/
24-
id: string;
25-
/** Display name for the ID. This is used to build the SARIF reporting descriptor object. */
26-
name: string;
27-
/**
28-
* Name of the CodeQL extractor. This is used to identify which tool component the reporting
29-
* descriptor object should be nested under in SARIF.
30-
*/
31-
extractorName?: string;
32-
/** An array of tags for the diagnostic. */
33-
tags?: DiagnosticTag[];
34-
};
37+
/** Information about the origin of the diagnostic. */
38+
source: DiagnosticSource;
3539
/** GitHub flavored Markdown formatted message. Should include inline links to any help pages. */
3640
markdownMessage?: string;
3741
/** Plain text message. Used by components where the string processing needed to support Markdown is cumbersome. */

0 commit comments

Comments
 (0)