From 79ddc65cadad6b09677d73572c1f8b52901d3d4a Mon Sep 17 00:00:00 2001 From: Connor Adams Date: Mon, 7 Aug 2023 16:36:19 +0100 Subject: [PATCH] Stop using legacy python.linting.mypyArgs (#107) --- src/common/settings.ts | 14 +------------- .../ts_tests/tests/common/settings.unit.test.ts | 13 ++++--------- 2 files changed, 5 insertions(+), 22 deletions(-) diff --git a/src/common/settings.ts b/src/common/settings.ts index 0ab41b9..8a650b6 100644 --- a/src/common/settings.ts +++ b/src/common/settings.ts @@ -52,19 +52,7 @@ function resolveVariables(value: string[], workspace?: WorkspaceFolder): string[ function getArgs(namespace: string, workspace: WorkspaceFolder): string[] { const config = getConfiguration(namespace, workspace.uri); const args = config.get('args', []); - - if (args.length > 0) { - return args; - } - - const legacyConfig = getConfiguration('python', workspace.uri); - const legacyArgs = legacyConfig.get('linting.mypyArgs', []); - if (legacyArgs.length > 0) { - traceLog(`Using legacy Mypy args from 'python.linting.mypyArgs': ${legacyArgs.join(' ')}.`); - return legacyArgs; - } - - return []; + return args; } function getPath(namespace: string, workspace: WorkspaceFolder): string[] { diff --git a/src/test/ts_tests/tests/common/settings.unit.test.ts b/src/test/ts_tests/tests/common/settings.unit.test.ts index da0e8de..86a3a54 100644 --- a/src/test/ts_tests/tests/common/settings.unit.test.ts +++ b/src/test/ts_tests/tests/common/settings.unit.test.ts @@ -75,7 +75,7 @@ suite('Settings Tests', () => { pythonConfigMock .setup((c) => c.get('linting.mypyArgs', [])) .returns(() => []) - .verifiable(TypeMoq.Times.atLeastOnce()); + .verifiable(TypeMoq.Times.never()); pythonConfigMock .setup((c) => c.get('linting.mypyPath', '')) .returns(() => 'mypy') @@ -214,8 +214,8 @@ suite('Settings Tests', () => { pythonConfigMock .setup((c) => c.get('linting.mypyArgs', [])) - .returns(() => ['${userHome}', '${workspaceFolder}', '${workspaceFolder:workspace1}', '${cwd}']) - .verifiable(TypeMoq.Times.atLeastOnce()); + .returns(() => []) + .verifiable(TypeMoq.Times.never()); pythonConfigMock .setup((c) => c.get('linting.mypyPath', '')) .returns(() => '${userHome}/bin/mypy') @@ -237,12 +237,7 @@ suite('Settings Tests', () => { const settings: ISettings = await getWorkspaceSettings('mypy', workspace1); assert.deepStrictEqual(settings.cwd, `${process.env.HOME || process.env.USERPROFILE}/bin`); - assert.deepStrictEqual(settings.args, [ - process.env.HOME || process.env.USERPROFILE, - workspace1.uri.fsPath, - workspace1.uri.fsPath, - process.cwd(), - ]); + assert.deepStrictEqual(settings.args, []); assert.deepStrictEqual(settings.importStrategy, 'useBundled'); assert.deepStrictEqual(settings.interpreter, []); assert.deepStrictEqual(settings.path, [`${process.env.HOME || process.env.USERPROFILE}/bin/mypy`]);