-
Notifications
You must be signed in to change notification settings - Fork 230
Refactor interpreted-data interface in preparation for other interpretations than SARIF #811
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -12,13 +12,14 @@ export const SELECT_TABLE_NAME = '#select'; | |||||
| export const ALERTS_TABLE_NAME = 'alerts'; | ||||||
|
|
||||||
| export type RawTableResultSet = { t: 'RawResultSet' } & RawResultSet; | ||||||
| export type PathTableResultSet = { | ||||||
| t: 'SarifResultSet'; | ||||||
| export type InterpretedResultSet<T> = { | ||||||
| t: 'InterpretedResultSet'; | ||||||
| readonly schema: ResultSetSchema; | ||||||
| name: string; | ||||||
| } & Interpretation; | ||||||
| interpretation: InterpretationT<T>; | ||||||
| }; | ||||||
|
|
||||||
| export type ResultSet = RawTableResultSet | PathTableResultSet; | ||||||
| export type ResultSet = RawTableResultSet | InterpretedResultSet<InterpretationData>; | ||||||
|
|
||||||
| /** | ||||||
| * Only ever show this many rows in a raw result table. | ||||||
|
|
@@ -46,18 +47,27 @@ export interface PreviousExecution { | |||||
| durationSeconds: number; | ||||||
| } | ||||||
|
|
||||||
| export interface Interpretation { | ||||||
| sourceLocationPrefix: string; | ||||||
| numTruncatedResults: number; | ||||||
| numTotalResults: number; | ||||||
| export type SarifInterpretationData = { | ||||||
| t: 'SarifInterpretationData'; | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here, you are added a nested I don't remember your other PR, so maybe there's a good reason to keep this.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is in preparation for export type GraphInterpretationData = {
t: 'GraphInterpretationData';
dot: string[];
};(from the other PR) so we can do dispatch on the types (this is how to do tagged unions in Typescript, right?) |
||||||
| /** | ||||||
| * sortState being undefined means don't sort, just present results in the order | ||||||
| * they appear in the sarif file. | ||||||
| */ | ||||||
| sortState?: InterpretedResultsSortState; | ||||||
| sarif: sarif.Log; | ||||||
| } & sarif.Log; | ||||||
|
|
||||||
| // Add more interpretation data kinds when needed (e.g., graph data) | ||||||
| export type InterpretationData = SarifInterpretationData; | ||||||
|
|
||||||
| export interface InterpretationT<T> { | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| sourceLocationPrefix: string; | ||||||
| numTruncatedResults: number; | ||||||
| numTotalResults: number; | ||||||
| data: T; | ||||||
| } | ||||||
|
|
||||||
| export type Interpretation = InterpretationT<InterpretationData>; | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't appear to work, I guess you can't have both a generic type and a non-generic type with the same name? |
||||||
|
|
||||||
| export interface ResultsPaths { | ||||||
| resultsPath: string; | ||||||
| interpretedResultsPath: string; | ||||||
|
|
@@ -358,7 +368,7 @@ export function getDefaultResultSetName( | |||||
| return [ | ||||||
| ALERTS_TABLE_NAME, | ||||||
| SELECT_TABLE_NAME, | ||||||
| resultSetNames[0], | ||||||
| resultSetNames[0] | ||||||
| ].filter((resultSetName) => resultSetNames.includes(resultSetName))[0]; | ||||||
| } | ||||||
|
|
||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.