Minor tidy-up
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import * as Sarif from 'sarif';
|
import * as Sarif from 'sarif';
|
||||||
import { AnalysisResults, HighlightedRegion } from '../remote-queries/shared/analysis-result';
|
import { HighlightedRegion } from '../remote-queries/shared/analysis-result';
|
||||||
import { ResolvableLocationValue } from './bqrs-cli-types';
|
import { ResolvableLocationValue } from './bqrs-cli-types';
|
||||||
|
|
||||||
export interface SarifLink {
|
export interface SarifLink {
|
||||||
@@ -236,11 +236,3 @@ export function parseHighlightedLine(
|
|||||||
|
|
||||||
return { plainSection1, highlightedSection, plainSection2 };
|
return { plainSection1, highlightedSection, plainSection2 };
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the number of (raw + interpreted) results for an analysis.
|
|
||||||
*/
|
|
||||||
export const getAnalysisResultCount = (analysisResults: AnalysisResults): number => {
|
|
||||||
const rawResultCount = analysisResults.rawResults?.resultSet.rows.length || 0;
|
|
||||||
return analysisResults.interpretedResults.length + rawResultCount;
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { createRemoteFileRef } from '../pure/location-link-utils';
|
import { createRemoteFileRef } from '../pure/location-link-utils';
|
||||||
import { getAnalysisResultCount, parseHighlightedLine, shouldHighlightLine } from '../pure/sarif-utils';
|
import { parseHighlightedLine, shouldHighlightLine } from '../pure/sarif-utils';
|
||||||
import { RemoteQuery } from './remote-query';
|
import { RemoteQuery } from './remote-query';
|
||||||
import { AnalysisAlert, AnalysisResults, CodeSnippet, FileLink, HighlightedRegion } from './shared/analysis-result';
|
import { AnalysisAlert, AnalysisResults, CodeSnippet, FileLink, getAnalysisResultCount, HighlightedRegion } from './shared/analysis-result';
|
||||||
|
|
||||||
// Each array item is a line of the markdown file.
|
// Each array item is a line of the markdown file.
|
||||||
export type MarkdownFile = string[];
|
export type MarkdownFile = string[];
|
||||||
@@ -14,13 +14,13 @@ export function generateMarkdown(query: RemoteQuery, analysesResults: AnalysisRe
|
|||||||
// Generate summary file with links to individual files
|
// Generate summary file with links to individual files
|
||||||
const summaryLines: MarkdownFile = generateMarkdownSummary(query);
|
const summaryLines: MarkdownFile = generateMarkdownSummary(query);
|
||||||
for (const analysisResult of analysesResults) {
|
for (const analysisResult of analysesResults) {
|
||||||
if (analysisResult.interpretedResults.length === 0 && !analysisResult.rawResults) {
|
const resultsCount = getAnalysisResultCount(analysisResult);
|
||||||
|
if (resultsCount === 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Append nwo and results count to the summary table
|
// Append nwo and results count to the summary table
|
||||||
const nwo = analysisResult.nwo;
|
const nwo = analysisResult.nwo;
|
||||||
const resultsCount = getAnalysisResultCount(analysisResult);
|
|
||||||
const link = createGistRelativeLink(nwo);
|
const link = createGistRelativeLink(nwo);
|
||||||
summaryLines.push(`| ${nwo} | [${resultsCount} result(s)](${link}) |`);
|
summaryLines.push(`| ${nwo} | [${resultsCount} result(s)](${link}) |`);
|
||||||
|
|
||||||
|
|||||||
@@ -78,3 +78,11 @@ export interface AnalysisMessageLocationToken {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export type ResultSeverity = 'Recommendation' | 'Warning' | 'Error';
|
export type ResultSeverity = 'Recommendation' | 'Warning' | 'Error';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the number of (raw + interpreted) results for an analysis.
|
||||||
|
*/
|
||||||
|
export const getAnalysisResultCount = (analysisResults: AnalysisResults): number => {
|
||||||
|
const rawResultCount = analysisResults.rawResults?.resultSet.rows.length || 0;
|
||||||
|
return analysisResults.interpretedResults.length + rawResultCount;
|
||||||
|
};
|
||||||
|
|||||||
@@ -13,14 +13,13 @@ import HorizontalSpace from './HorizontalSpace';
|
|||||||
import Badge from './Badge';
|
import Badge from './Badge';
|
||||||
import ViewTitle from './ViewTitle';
|
import ViewTitle from './ViewTitle';
|
||||||
import DownloadButton from './DownloadButton';
|
import DownloadButton from './DownloadButton';
|
||||||
import { AnalysisResults } from '../shared/analysis-result';
|
import { AnalysisResults, getAnalysisResultCount } from '../shared/analysis-result';
|
||||||
import DownloadSpinner from './DownloadSpinner';
|
import DownloadSpinner from './DownloadSpinner';
|
||||||
import CollapsibleItem from './CollapsibleItem';
|
import CollapsibleItem from './CollapsibleItem';
|
||||||
import { AlertIcon, CodeSquareIcon, FileCodeIcon, RepoIcon, TerminalIcon } from '@primer/octicons-react';
|
import { AlertIcon, CodeSquareIcon, FileCodeIcon, RepoIcon, TerminalIcon } from '@primer/octicons-react';
|
||||||
import AnalysisAlertResult from './AnalysisAlertResult';
|
import AnalysisAlertResult from './AnalysisAlertResult';
|
||||||
import RawResultsTable from './RawResultsTable';
|
import RawResultsTable from './RawResultsTable';
|
||||||
import RepositoriesSearch from './RepositoriesSearch';
|
import RepositoriesSearch from './RepositoriesSearch';
|
||||||
import { getAnalysisResultCount } from '../../pure/sarif-utils';
|
|
||||||
|
|
||||||
const numOfReposInContractedMode = 10;
|
const numOfReposInContractedMode = 10;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user