Skip to content

Commit

Permalink
QD-9035 Handle case when no workspace is opened for local run
Browse files Browse the repository at this point in the history
  • Loading branch information
evgenyim committed May 13, 2024
1 parent 5e71d91 commit 8375a21
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 6 additions & 2 deletions vscode/qodana/src/core/cli/executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { getLanguagesInWorkspace, getLinterByCode as getLinterImageByCode, getLi
import * as os from 'os';
import * as path from 'path';
import * as fs from 'fs';
import {NO_LINTERS_FOUND, NO_REPORT_FOUND, scanFinished} from '../messages';
import {NO_LINTERS_FOUND, NO_REPORT_FOUND, NO_WORKSPACE_OPENED, scanFinished} from '../messages';
import { Events } from '../events';
import {LOCAL_REPORT, WS_REPORT_ID} from '../config';

Expand Down Expand Up @@ -72,7 +72,11 @@ export async function prepareRun(token: string): Promise<boolean> {
let langs = await getLanguagesInWorkspace();
let { communityLinters, paidLinters } = getLinters(langs);
if (communityLinters.length === 0 && paidLinters.length === 0) {
vscode.window.showErrorMessage(NO_LINTERS_FOUND);
if (vscode.workspace.workspaceFolders === undefined) {
vscode.window.showErrorMessage(NO_WORKSPACE_OPENED);
} else {
vscode.window.showErrorMessage(NO_LINTERS_FOUND);
}
return false;
}

Expand Down
1 change: 1 addition & 0 deletions vscode/qodana/src/core/messages/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export const GET_TOKEN = vscode.l10n.t('[Qodana] Enter Qodana token.');
// SELECTION

export const NO_LINTERS_FOUND = vscode.l10n.t('[Qodana] No supported linters found in the workspace.');
export const NO_WORKSPACE_OPENED = vscode.l10n.t('[Qodana] No workspace is currently opened.');

// CLI EXECUTION

Expand Down

0 comments on commit 8375a21

Please sign in to comment.