Address review comments
This commit is contained in:
committed by
Andrew Eisenberg
parent
d9a04ea895
commit
ddca0bb851
@@ -702,7 +702,7 @@ export class CodeQLCliServer implements Disposable {
|
||||
await this.runCodeQlCliCommand(['bqrs', 'interpret'], args, 'Interpreting query results');
|
||||
}
|
||||
|
||||
async interpretBqrs(metadata: QueryMetadata, resultsPath: string, interpretedResultsPath: string, sourceInfo?: SourceInfo): Promise<sarif.Log> {
|
||||
async interpretBqrsSarif(metadata: QueryMetadata, resultsPath: string, interpretedResultsPath: string, sourceInfo?: SourceInfo): Promise<sarif.Log> {
|
||||
const additionalArgs = [
|
||||
// TODO: This flag means that we don't group interpreted results
|
||||
// by primary location. We may want to revisit whether we call
|
||||
@@ -710,7 +710,7 @@ export class CodeQLCliServer implements Disposable {
|
||||
// grouping client-side.
|
||||
'--no-group-results'
|
||||
];
|
||||
|
||||
|
||||
await this.runInterpretCommand(SARIF_FORMAT, additionalArgs, metadata, resultsPath, interpretedResultsPath, sourceInfo);
|
||||
return await sarifParser(interpretedResultsPath);
|
||||
}
|
||||
|
||||
@@ -607,12 +607,12 @@ export class InterfaceManager extends DisposableObject {
|
||||
|
||||
const numTotalResults = sarif.runs[0]?.results?.length || 0;
|
||||
|
||||
sarif.sortState = sortState;
|
||||
const interpretation: Interpretation = {
|
||||
data: sarif,
|
||||
sourceLocationPrefix,
|
||||
numTruncatedResults: 0,
|
||||
numTotalResults,
|
||||
sortState,
|
||||
numTotalResults
|
||||
};
|
||||
this._interpretation = interpretation;
|
||||
return interpretation;
|
||||
|
||||
@@ -49,6 +49,11 @@ export interface PreviousExecution {
|
||||
|
||||
export type SarifInterpretationData = {
|
||||
t: 'SarifInterpretationData';
|
||||
/**
|
||||
* sortState being undefined means don't sort, just present results in the order
|
||||
* they appear in the sarif file.
|
||||
*/
|
||||
sortState?: InterpretedResultsSortState;
|
||||
} & sarif.Log;
|
||||
|
||||
// Add more interpretation data kinds when needed (e.g., graph data)
|
||||
@@ -58,11 +63,6 @@ export interface InterpretationT<T> {
|
||||
sourceLocationPrefix: string;
|
||||
numTruncatedResults: number;
|
||||
numTotalResults: number;
|
||||
/**
|
||||
* sortState being undefined means don't sort, just present results in the order
|
||||
* they appear in the sarif file.
|
||||
*/
|
||||
sortState?: InterpretedResultsSortState;
|
||||
data: T;
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ export class PathTable extends React.Component<PathTableProps, PathTableState> {
|
||||
}
|
||||
|
||||
sortClass(column: InterpretedResultsSortColumn): string {
|
||||
const sortState = this.props.resultSet.interpretation.sortState;
|
||||
const sortState = this.props.resultSet.interpretation.data.sortState;
|
||||
if (sortState !== undefined && sortState.sortBy === column) {
|
||||
return sortState.sortDirection === SortDirection.asc ? 'sort-asc' : 'sort-desc';
|
||||
}
|
||||
@@ -61,7 +61,7 @@ export class PathTable extends React.Component<PathTableProps, PathTableState> {
|
||||
}
|
||||
|
||||
getNextSortState(column: InterpretedResultsSortColumn): InterpretedResultsSortState | undefined {
|
||||
const oldSortState = this.props.resultSet.interpretation.sortState;
|
||||
const oldSortState = this.props.resultSet.interpretation.data.sortState;
|
||||
const prevDirection = oldSortState && oldSortState.sortBy === column ? oldSortState.sortDirection : undefined;
|
||||
const nextDirection = nextSortDirection(prevDirection, true);
|
||||
return nextDirection === undefined ? undefined :
|
||||
|
||||
@@ -354,15 +354,8 @@ class ResultTable extends React.Component<ResultTableProps, Record<string, never
|
||||
switch (resultSet.t) {
|
||||
case 'RawResultSet': return <RawTable
|
||||
{...this.props} resultSet={resultSet} />;
|
||||
case 'InterpretedResultSet': {
|
||||
const data = resultSet.interpretation.data;
|
||||
switch (data.t) {
|
||||
case 'SarifInterpretationData': {
|
||||
const sarifResultSet = { ...resultSet, interpretation: { ...resultSet.interpretation, data } };
|
||||
return <PathTable {...this.props} resultSet={sarifResultSet} />;
|
||||
}
|
||||
}
|
||||
}
|
||||
case 'InterpretedResultSet': return <PathTable
|
||||
{...this.props} resultSet={resultSet} />;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -283,7 +283,7 @@ class App extends React.Component<Record<string, never>, ResultsViewState> {
|
||||
}
|
||||
sortStates={displayedResults.results.sortStates}
|
||||
interpretedSortState={
|
||||
displayedResults.resultsInfo.interpretation?.sortState
|
||||
displayedResults.resultsInfo.interpretation?.data.sortState
|
||||
}
|
||||
isLoadingNewResults={
|
||||
this.state.isExpectingResultsUpdate ||
|
||||
|
||||
Reference in New Issue
Block a user