Skip to content

Commit 12dc378

Browse files
authored
Merge pull request #1305 from github/aeisenberg/mrva-result-message
Update the warning message after running variant analysis
2 parents 91b17f8 + bbe99f4 commit 12dc378

2 files changed

Lines changed: 25 additions & 14 deletions

File tree

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

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { CancellationToken, Uri, window } from 'vscode';
22
import * as path from 'path';
33
import * as yaml from 'js-yaml';
44
import * as fs from 'fs-extra';
5+
import * as os from 'os';
56
import * as tmp from 'tmp-promise';
67
import {
78
askForLanguage,
@@ -337,22 +338,26 @@ async function runRemoteQueriesApiRequest(
337338
}
338339
}
339340

341+
const eol = os.EOL;
342+
const eol2 = os.EOL + os.EOL;
343+
340344
// exported for testng only
341345
export function parseResponse(owner: string, repo: string, response: QueriesResponse) {
342346
const popupMessage = `Successfully scheduled runs. [Click here to see the progress](https://github.com/${owner}/${repo}/actions/runs/${response.workflow_run_id}).`
343-
+ (response.errors ? '\n\nSome repositories could not be scheduled. See extension log for details.' : '');
347+
+ (response.errors ? `${eol2}Some repositories could not be scheduled. See extension log for details.` : '');
344348

345349
let logMessage = `Successfully scheduled runs. See https://github.com/${owner}/${repo}/actions/runs/${response.workflow_run_id}.`;
346350
if (response.repositories_queried) {
347-
logMessage += `\n\nRepositories queried:\n${response.repositories_queried.join(', ')}`;
351+
logMessage += `${eol2}Repositories queried:${eol}${response.repositories_queried.join(', ')}`;
348352
}
349353
if (response.errors) {
350-
logMessage += '\n\nSome repositories could not be scheduled.';
354+
logMessage += `${eol2}Some repositories could not be scheduled.`;
351355
if (response.errors.invalid_repositories?.length) {
352-
logMessage += `\n\nInvalid repositories:\n${response.errors.invalid_repositories.join(', ')}`;
356+
logMessage += `${eol2}Invalid repositories:${eol}${response.errors.invalid_repositories.join(', ')}`;
353357
}
354358
if (response.errors.repositories_without_database?.length) {
355-
logMessage += `\n\nRepositories without databases:\n${response.errors.repositories_without_database.join(', ')}`;
359+
logMessage += `${eol2}Repositories without databases:${eol}${response.errors.repositories_without_database.join(', ')}`;
360+
logMessage += `${eol}These repositories have been added to the database storage service and we will attempt to create a database for them next time the store is updated.`;
356361
}
357362
}
358363

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

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { expect } from 'chai';
2+
import * as os from 'os';
23
import { parseResponse } from '../../../remote-queries/run-remote-query';
34

45
describe('run-remote-query', () => {
@@ -14,7 +15,7 @@ describe('run-remote-query', () => {
1415
['Successfully scheduled runs. See https://github.com/org/name/actions/runs/123.',
1516
'',
1617
'Repositories queried:',
17-
'a/b, c/d'].join('\n')
18+
'a/b, c/d'].join(os.EOL),
1819
);
1920
});
2021

@@ -41,7 +42,7 @@ describe('run-remote-query', () => {
4142
expect(result.popupMessage).to.equal(
4243
['Successfully scheduled runs. [Click here to see the progress](https://github.com/org/name/actions/runs/123).',
4344
'',
44-
'Some repositories could not be scheduled. See extension log for details.'].join('\n')
45+
'Some repositories could not be scheduled. See extension log for details.'].join(os.EOL)
4546
);
4647
expect(result.logMessage).to.equal(
4748
['Successfully scheduled runs. See https://github.com/org/name/actions/runs/123.',
@@ -52,7 +53,7 @@ describe('run-remote-query', () => {
5253
'Some repositories could not be scheduled.',
5354
'',
5455
'Invalid repositories:',
55-
'e/f, g/h'].join('\n')
56+
'e/f, g/h'].join(os.EOL)
5657
);
5758
});
5859

@@ -68,16 +69,19 @@ describe('run-remote-query', () => {
6869
expect(result.popupMessage).to.equal(
6970
['Successfully scheduled runs. [Click here to see the progress](https://github.com/org/name/actions/runs/123).',
7071
'',
71-
'Some repositories could not be scheduled. See extension log for details.'].join('\n')
72+
'Some repositories could not be scheduled. See extension log for details.'].join(os.EOL)
7273
);
7374
expect(result.logMessage).to.equal(
7475
['Successfully scheduled runs. See https://github.com/org/name/actions/runs/123.',
7576
'',
76-
'Repositories queried:\na/b, c/d',
77+
'Repositories queried:',
78+
'a/b, c/d',
7779
'',
7880
'Some repositories could not be scheduled.',
7981
'',
80-
'Repositories without databases:\ne/f, g/h'].join('\n')
82+
'Repositories without databases:',
83+
'e/f, g/h',
84+
'These repositories have been added to the database storage service and we will attempt to create a database for them next time the store is updated.'].join(os.EOL)
8185
);
8286
});
8387

@@ -94,20 +98,22 @@ describe('run-remote-query', () => {
9498
expect(result.popupMessage).to.equal(
9599
['Successfully scheduled runs. [Click here to see the progress](https://github.com/org/name/actions/runs/123).',
96100
'',
97-
'Some repositories could not be scheduled. See extension log for details.'].join('\n')
101+
'Some repositories could not be scheduled. See extension log for details.'].join(os.EOL)
98102
);
99103
expect(result.logMessage).to.equal(
100104
['Successfully scheduled runs. See https://github.com/org/name/actions/runs/123.',
101105
'',
102-
'Repositories queried:\na/b, c/d',
106+
'Repositories queried:',
107+
'a/b, c/d',
103108
'',
104109
'Some repositories could not be scheduled.',
105110
'',
106111
'Invalid repositories:',
107112
'e/f, g/h',
108113
'',
109114
'Repositories without databases:',
110-
'i/j, k/l'].join('\n')
115+
'i/j, k/l',
116+
'These repositories have been added to the database storage service and we will attempt to create a database for them next time the store is updated.'].join(os.EOL)
111117
);
112118
});
113119
});

0 commit comments

Comments
 (0)