Skip to content

Commit a2b8e7d

Browse files
committed
Rename function
1 parent b59638b commit a2b8e7d

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

extensions/ql-vscode/src/run-remote-query.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,12 @@ async function runRemoteQueriesApiRequest(credentials: Credentials, ref: string,
130130
void showAndLogInformationMessage(`Successfully scheduled runs. [Click here to see the progress](https://github.com/${OWNER}/${REPO}/actions).`);
131131

132132
} catch (error) {
133-
await validateRepositories(error, credentials, ref, language, repositories, query);
133+
await attemptRerun(error, credentials, ref, language, repositories, query);
134134
}
135135
}
136136

137-
export async function validateRepositories(error: any, credentials: Credentials, ref: string, language: string, repositories: string[], query: string) {
137+
/** Attempts to rerun the query on only the valid repositories */
138+
export async function attemptRerun(error: any, credentials: Credentials, ref: string, language: string, repositories: string[], query: string) {
138139
if (typeof error.message === 'string' && error.message.includes('Some repositories were invalid')) {
139140
const invalidRepos = error?.response?.data?.invalid_repos || [];
140141
const reposWithoutDbUploads = error?.response?.data?.repos_without_db_uploads || [];

extensions/ql-vscode/src/vscode-tests/no-workspace/run-remote-query.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ describe('run-remote-query', function() {
105105

106106
});
107107

108-
describe('validateRepositories', () => {
108+
describe('attemptRerun', () => {
109109
let sandbox: sinon.SinonSandbox;
110110
let showAndLogErrorMessageSpy: sinon.SinonStub;
111111
let showInformationMessageWithActionSpy: sinon.SinonStub;
@@ -152,7 +152,7 @@ describe('run-remote-query', function() {
152152
const repositories = ['abc/def', 'ghi/jkl', 'mno/pqr', 'stu/vwx'];
153153

154154
// make the function call
155-
await mod.validateRepositories(error, credentials, ref, language, repositories, query);
155+
await mod.attemptRerun(error, credentials, ref, language, repositories, query);
156156

157157
// check logging output
158158
expect(logSpy.firstCall.args[0]).to.contain('Unable to run query');
@@ -168,7 +168,7 @@ describe('run-remote-query', function() {
168168
showInformationMessageWithActionSpy.resolves(true);
169169

170170
// make the function call
171-
await mod.validateRepositories(error, credentials, ref, language, repositories, query);
171+
await mod.attemptRerun(error, credentials, ref, language, repositories, query);
172172

173173
// check logging output
174174
expect(logSpy.firstCall.args[0]).to.contain('Unable to run query');

0 commit comments

Comments
 (0)