Rename numRepositoriesQueries to repositoryCount
To make it consistent with `resultCount`.
This commit is contained in:
@@ -67,10 +67,10 @@ export class HistoryItemLabelProvider {
|
||||
|
||||
// Return the number of repositories queried if available. Otherwise, use the controller repository name.
|
||||
private buildRepoLabel(item: RemoteQueryHistoryItem): string {
|
||||
const numRepositoriesQueried = item.remoteQuery.numRepositoriesQueried;
|
||||
const repositoryCount = item.remoteQuery.repositoryCount;
|
||||
|
||||
if (numRepositoriesQueried) {
|
||||
return pluralize(numRepositoriesQueried, 'repository', 'repositories');
|
||||
if (repositoryCount) {
|
||||
return pluralize(repositoryCount, 'repository', 'repositories');
|
||||
}
|
||||
|
||||
return `${item.remoteQuery.controllerRepository.owner}/${item.remoteQuery.controllerRepository.name}`;
|
||||
|
||||
@@ -110,7 +110,7 @@ export async function exportResultsToGist(
|
||||
const buildGistDescription = (query: RemoteQuery, analysesResults: AnalysisResults[]) => {
|
||||
const resultCount = sumAnalysesResults(analysesResults);
|
||||
const resultLabel = pluralize(resultCount, 'result', 'results');
|
||||
const repositoryLabel = pluralize(query.numRepositoriesQueried, 'repository', 'repositories');
|
||||
const repositoryLabel = pluralize(query.repositoryCount, 'repository', 'repositories');
|
||||
return `${query.queryName} (${query.language}) ${resultLabel} (${repositoryLabel})`;
|
||||
};
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ export interface UpdatedQueryStatusEvent {
|
||||
queryId: string;
|
||||
status: QueryStatus;
|
||||
failureReason?: string;
|
||||
numRepositoriesQueried?: number;
|
||||
repositoryCount?: number;
|
||||
resultCount?: number;
|
||||
}
|
||||
|
||||
@@ -322,7 +322,7 @@ export class RemoteQueriesManager extends DisposableObject {
|
||||
this.remoteQueryStatusUpdateEventEmitter.fire({
|
||||
queryId,
|
||||
status: QueryStatus.Completed,
|
||||
numRepositoriesQueried: queryResult.analysisSummaries.length,
|
||||
repositoryCount: queryResult.analysisSummaries.length,
|
||||
resultCount
|
||||
});
|
||||
|
||||
|
||||
@@ -8,5 +8,5 @@ export interface RemoteQuery {
|
||||
controllerRepository: Repository;
|
||||
executionStartTime: number; // Use number here since it needs to be serialized and desserialized.
|
||||
actionsWorkflowRunId: number;
|
||||
numRepositoriesQueried: number;
|
||||
repositoryCount: number;
|
||||
}
|
||||
|
||||
@@ -271,7 +271,7 @@ export async function runRemoteQuery(
|
||||
}
|
||||
|
||||
const workflowRunId = apiResponse.workflow_run_id;
|
||||
const numRepositoriesQueried = apiResponse.repositories_queried.length;
|
||||
const repositoryCount = apiResponse.repositories_queried.length;
|
||||
const remoteQuery = await buildRemoteQueryEntity(
|
||||
queryFile,
|
||||
queryMetadata,
|
||||
@@ -280,7 +280,7 @@ export async function runRemoteQuery(
|
||||
queryStartTime,
|
||||
workflowRunId,
|
||||
language,
|
||||
numRepositoriesQueried);
|
||||
repositoryCount);
|
||||
|
||||
// don't return the path because it has been deleted
|
||||
return { query: remoteQuery };
|
||||
@@ -356,12 +356,12 @@ const eol2 = os.EOL + os.EOL;
|
||||
// exported for testing only
|
||||
export function parseResponse(owner: string, repo: string, response: QueriesResponse) {
|
||||
const repositoriesQueried = response.repositories_queried;
|
||||
const numRepositoriesQueried = repositoriesQueried.length;
|
||||
const repositoryCount = repositoriesQueried.length;
|
||||
|
||||
const popupMessage = `Successfully scheduled runs on ${pluralize(numRepositoriesQueried, 'repository', 'repositories')}. [Click here to see the progress](https://github.com/${owner}/${repo}/actions/runs/${response.workflow_run_id}).`
|
||||
const popupMessage = `Successfully scheduled runs on ${pluralize(repositoryCount, 'repository', 'repositories')}. [Click here to see the progress](https://github.com/${owner}/${repo}/actions/runs/${response.workflow_run_id}).`
|
||||
+ (response.errors ? `${eol2}Some repositories could not be scheduled. See extension log for details.` : '');
|
||||
|
||||
let logMessage = `Successfully scheduled runs on ${pluralize(numRepositoriesQueried, 'repository', 'repositories')}. See https://github.com/${owner}/${repo}/actions/runs/${response.workflow_run_id}.`;
|
||||
let logMessage = `Successfully scheduled runs on ${pluralize(repositoryCount, 'repository', 'repositories')}. See https://github.com/${owner}/${repo}/actions/runs/${response.workflow_run_id}.`;
|
||||
logMessage += `${eol2}Repositories queried:${eol}${repositoriesQueried.join(', ')}`;
|
||||
if (response.errors) {
|
||||
const { invalid_repositories, repositories_without_database, private_repositories, cutoff_repositories, cutoff_repositories_count } = response.errors;
|
||||
@@ -430,7 +430,7 @@ async function buildRemoteQueryEntity(
|
||||
queryStartTime: number,
|
||||
workflowRunId: number,
|
||||
language: string,
|
||||
numRepositoriesQueried: number
|
||||
repositoryCount: number
|
||||
): Promise<RemoteQuery> {
|
||||
// The query name is either the name as specified in the query metadata, or the file name.
|
||||
const queryName = queryMetadata?.name ?? path.basename(queryFilePath);
|
||||
@@ -448,6 +448,6 @@ async function buildRemoteQueryEntity(
|
||||
},
|
||||
executionStartTime: queryStartTime,
|
||||
actionsWorkflowRunId: workflowRunId,
|
||||
numRepositoriesQueried: numRepositoriesQueried,
|
||||
repositoryCount: repositoryCount,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -6,5 +6,5 @@
|
||||
"controllerRepository": { "owner": "dsp-testing", "name": "qc-controller" },
|
||||
"executionStartTime": 1649419081990,
|
||||
"actionsWorkflowRunId": 2115000864,
|
||||
"numRepositoriesQueried": 10
|
||||
"repositoryCount": 10
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ describe('HistoryItemLabelProvider', () => {
|
||||
expect(labelProvider.getShortLabel(fqi)).to.eq('query-name');
|
||||
});
|
||||
|
||||
function createMockRemoteQueryInfo(userSpecifiedLabel?: string, numRepositoriesQueried?: number) {
|
||||
function createMockRemoteQueryInfo(userSpecifiedLabel?: string, repositoryCount?: number) {
|
||||
return {
|
||||
t: 'remote',
|
||||
userSpecifiedLabel,
|
||||
@@ -139,7 +139,7 @@ describe('HistoryItemLabelProvider', () => {
|
||||
name: 'vscode-codeql-integration-tests'
|
||||
},
|
||||
language: 'javascript',
|
||||
numRepositoriesQueried,
|
||||
repositoryCount,
|
||||
},
|
||||
status: 'in progress',
|
||||
resultCount: 16,
|
||||
|
||||
Reference in New Issue
Block a user