Skip to content

Commit 44145ba

Browse files
committed
Use os.EOL instead of \n
1 parent 2ebdbaa commit 44145ba

2 files changed

Lines changed: 12 additions & 7 deletions

File tree

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

Lines changed: 10 additions & 6 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,
@@ -338,22 +339,25 @@ async function runRemoteQueriesApiRequest(
338339
}
339340

340341
// exported for testng only
342+
const eol = os.EOL;
343+
const eol2 = os.EOL + os.EOL;
344+
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(', ')}`;
356-
logMessage += '\nThese 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.';
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.`;
357361
}
358362
}
359363

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

Lines changed: 2 additions & 1 deletion
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

0 commit comments

Comments
 (0)