Skip to content

Commit

Permalink
Remove all linter settings
Browse files Browse the repository at this point in the history
  • Loading branch information
karthiknadig committed Oct 19, 2023
1 parent 563e661 commit 4544f19
Show file tree
Hide file tree
Showing 21 changed files with 4 additions and 2,179 deletions.
436 changes: 0 additions & 436 deletions package.json

Large diffs are not rendered by default.

123 changes: 0 additions & 123 deletions package.nls.json

Large diffs are not rendered by default.

90 changes: 0 additions & 90 deletions src/client/common/configSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import * as fs from 'fs';
import {
ConfigurationChangeEvent,
ConfigurationTarget,
DiagnosticSeverity,
Disposable,
Event,
EventEmitter,
Expand All @@ -29,7 +28,6 @@ import {
IExperiments,
IInterpreterPathService,
IInterpreterSettings,
ILintingSettings,
IPythonSettings,
ITensorBoardSettings,
ITerminalSettings,
Expand Down Expand Up @@ -106,8 +104,6 @@ export class PythonSettings implements IPythonSettings {

public devOptions: string[] = [];

public linting!: ILintingSettings;

public autoComplete!: IAutoCompleteSettings;

public tensorBoard: ITensorBoardSettings | undefined;
Expand Down Expand Up @@ -304,94 +300,8 @@ export class PythonSettings implements IPythonSettings {
this.devOptions = systemVariables.resolveAny(pythonSettings.get<any[]>('devOptions'))!;
this.devOptions = Array.isArray(this.devOptions) ? this.devOptions : [];

const lintingSettings = systemVariables.resolveAny(pythonSettings.get<ILintingSettings>('linting'))!;
if (this.linting) {
Object.assign<ILintingSettings, ILintingSettings>(this.linting, lintingSettings);
} else {
this.linting = lintingSettings;
}

this.globalModuleInstallation = pythonSettings.get<boolean>('globalModuleInstallation') === true;

// Support for travis.
this.linting = this.linting
? this.linting
: {
enabled: false,
cwd: undefined,
ignorePatterns: [],
flake8Args: [],
flake8Enabled: false,
flake8Path: 'flake8',
lintOnSave: false,
maxNumberOfProblems: 100,
mypyArgs: [],
mypyEnabled: false,
mypyPath: 'mypy',
banditArgs: [],
banditEnabled: false,
banditPath: 'bandit',
pycodestyleArgs: [],
pycodestyleEnabled: false,
pycodestylePath: 'pycodestyle',
pylamaArgs: [],
pylamaEnabled: false,
pylamaPath: 'pylama',
prospectorArgs: [],
prospectorEnabled: false,
prospectorPath: 'prospector',
pydocstyleArgs: [],
pydocstyleEnabled: false,
pydocstylePath: 'pydocstyle',
pylintArgs: [],
pylintEnabled: false,
pylintPath: 'pylint',
pylintCategorySeverity: {
convention: DiagnosticSeverity.Hint,
error: DiagnosticSeverity.Error,
fatal: DiagnosticSeverity.Error,
refactor: DiagnosticSeverity.Hint,
warning: DiagnosticSeverity.Warning,
},
pycodestyleCategorySeverity: {
E: DiagnosticSeverity.Error,
W: DiagnosticSeverity.Warning,
},
flake8CategorySeverity: {
E: DiagnosticSeverity.Error,
W: DiagnosticSeverity.Warning,
// Per http://flake8.pycqa.org/en/latest/glossary.html#term-error-code
// 'F' does not mean 'fatal as in PyLint but rather 'pyflakes' such as
// unused imports, variables, etc.
F: DiagnosticSeverity.Warning,
},
mypyCategorySeverity: {
error: DiagnosticSeverity.Error,
note: DiagnosticSeverity.Hint,
},
};
this.linting.pylintPath = getAbsolutePath(systemVariables.resolveAny(this.linting.pylintPath), workspaceRoot);
this.linting.flake8Path = getAbsolutePath(systemVariables.resolveAny(this.linting.flake8Path), workspaceRoot);
this.linting.pycodestylePath = getAbsolutePath(
systemVariables.resolveAny(this.linting.pycodestylePath),
workspaceRoot,
);
this.linting.pylamaPath = getAbsolutePath(systemVariables.resolveAny(this.linting.pylamaPath), workspaceRoot);
this.linting.prospectorPath = getAbsolutePath(
systemVariables.resolveAny(this.linting.prospectorPath),
workspaceRoot,
);
this.linting.pydocstylePath = getAbsolutePath(
systemVariables.resolveAny(this.linting.pydocstylePath),
workspaceRoot,
);
this.linting.mypyPath = getAbsolutePath(systemVariables.resolveAny(this.linting.mypyPath), workspaceRoot);
this.linting.banditPath = getAbsolutePath(systemVariables.resolveAny(this.linting.banditPath), workspaceRoot);

if (this.linting.cwd) {
this.linting.cwd = getAbsolutePath(systemVariables.resolveAny(this.linting.cwd), workspaceRoot);
}

const testSettings = systemVariables.resolveAny(pythonSettings.get<ITestingSettings>('testing'))!;
if (this.testing) {
Object.assign<ITestingSettings, ITestingSettings>(this.testing, testSettings);
Expand Down
16 changes: 0 additions & 16 deletions src/client/common/installer/moduleInstaller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,26 +238,10 @@ export abstract class ModuleInstaller implements IModuleInstaller {

export function translateProductToModule(product: Product): string {
switch (product) {
case Product.mypy:
return 'mypy';
case Product.pylama:
return 'pylama';
case Product.prospector:
return 'prospector';
case Product.pylint:
return 'pylint';
case Product.pytest:
return 'pytest';
case Product.pycodestyle:
return 'pycodestyle';
case Product.pydocstyle:
return 'pydocstyle';
case Product.flake8:
return 'flake8';
case Product.unittest:
return 'unittest';
case Product.bandit:
return 'bandit';
case Product.tensorboard:
return 'tensorboard';
case Product.torchProfilerInstallName:
Expand Down
8 changes: 0 additions & 8 deletions src/client/common/installer/productNames.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,6 @@
import { Product } from '../types';

export const ProductNames = new Map<Product, string>();
ProductNames.set(Product.bandit, 'bandit');
ProductNames.set(Product.flake8, 'flake8');
ProductNames.set(Product.mypy, 'mypy');
ProductNames.set(Product.pycodestyle, 'pycodestyle');
ProductNames.set(Product.pylama, 'pylama');
ProductNames.set(Product.prospector, 'prospector');
ProductNames.set(Product.pydocstyle, 'pydocstyle');
ProductNames.set(Product.pylint, 'pylint');
ProductNames.set(Product.pytest, 'pytest');
ProductNames.set(Product.tensorboard, 'tensorboard');
ProductNames.set(Product.torchProfilerInstallName, 'torch-tb-profiler');
Expand Down
67 changes: 0 additions & 67 deletions src/client/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
CancellationToken,
ConfigurationChangeEvent,
ConfigurationTarget,
DiagnosticSeverity,
Disposable,
DocumentSymbolProvider,
Event,
Expand Down Expand Up @@ -92,15 +91,7 @@ export enum ProductType {

export enum Product {
pytest = 1,
pylint = 3,
flake8 = 4,
pycodestyle = 5,
pylama = 6,
prospector = 7,
pydocstyle = 8,
mypy = 11,
unittest = 12,
bandit = 17,
tensorboard = 24,
torchProfilerInstallName = 25,
torchProfilerImportName = 26,
Expand Down Expand Up @@ -177,7 +168,6 @@ export interface IPythonSettings {
readonly pipenvPath: string;
readonly poetryPath: string;
readonly devOptions: string[];
readonly linting: ILintingSettings;
readonly testing: ITestingSettings;
readonly autoComplete: IAutoCompleteSettings;
readonly terminal: ITerminalSettings;
Expand All @@ -195,67 +185,10 @@ export interface ITensorBoardSettings {
logDirectory: string | undefined;
}

export interface IPylintCategorySeverity {
readonly convention: DiagnosticSeverity;
readonly refactor: DiagnosticSeverity;
readonly warning: DiagnosticSeverity;
readonly error: DiagnosticSeverity;
readonly fatal: DiagnosticSeverity;
}
export interface IPycodestyleCategorySeverity {
readonly W: DiagnosticSeverity;
readonly E: DiagnosticSeverity;
}

export interface Flake8CategorySeverity {
readonly F: DiagnosticSeverity;
readonly E: DiagnosticSeverity;
readonly W: DiagnosticSeverity;
}
export interface IMypyCategorySeverity {
readonly error: DiagnosticSeverity;
readonly note: DiagnosticSeverity;
}
export interface IInterpreterSettings {
infoVisibility: 'never' | 'onPythonRelated' | 'always';
}

export interface ILintingSettings {
readonly enabled: boolean;
readonly ignorePatterns: string[];
readonly prospectorEnabled: boolean;
readonly prospectorArgs: string[];
readonly pylintEnabled: boolean;
readonly pylintArgs: string[];
readonly pycodestyleEnabled: boolean;
readonly pycodestyleArgs: string[];
readonly pylamaEnabled: boolean;
readonly pylamaArgs: string[];
readonly flake8Enabled: boolean;
readonly flake8Args: string[];
readonly pydocstyleEnabled: boolean;
readonly pydocstyleArgs: string[];
readonly lintOnSave: boolean;
readonly maxNumberOfProblems: number;
readonly pylintCategorySeverity: IPylintCategorySeverity;
readonly pycodestyleCategorySeverity: IPycodestyleCategorySeverity;
readonly flake8CategorySeverity: Flake8CategorySeverity;
readonly mypyCategorySeverity: IMypyCategorySeverity;
cwd?: string;
prospectorPath: string;
pylintPath: string;
pycodestylePath: string;
pylamaPath: string;
flake8Path: string;
pydocstylePath: string;
mypyEnabled: boolean;
mypyArgs: string[];
mypyPath: string;
banditEnabled: boolean;
banditArgs: string[];
banditPath: string;
}

export interface ITerminalSettings {
readonly executeInFileDir: boolean;
readonly focusAfterLaunch: boolean;
Expand Down
11 changes: 0 additions & 11 deletions src/client/common/utils/localize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -506,14 +506,3 @@ export namespace CreateEnv {
export const disableCheckWorkspace = l10n.t('Disable (Workspace)');
}
}

export namespace ToolsExtensions {
export const flake8PromptMessage = l10n.t(
'Use the Flake8 extension to enable easier configuration and new features such as quick fixes.',
);
export const pylintPromptMessage = l10n.t(
'Use the Pylint extension to enable easier configuration and new features such as quick fixes.',
);
export const installPylintExtension = l10n.t('Install Pylint extension');
export const installFlake8Extension = l10n.t('Install Flake8 extension');
}
5 changes: 0 additions & 5 deletions src/client/telemetry/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,6 @@ export enum EventName {

ENVIRONMENT_CHECK_TRIGGER = 'ENVIRONMENT.CHECK.TRIGGER',
ENVIRONMENT_CHECK_RESULT = 'ENVIRONMENT.CHECK.RESULT',

TOOLS_EXTENSIONS_ALREADY_INSTALLED = 'TOOLS_EXTENSIONS.ALREADY_INSTALLED',
TOOLS_EXTENSIONS_PROMPT_SHOWN = 'TOOLS_EXTENSIONS.PROMPT_SHOWN',
TOOLS_EXTENSIONS_INSTALL_SELECTED = 'TOOLS_EXTENSIONS.INSTALL_SELECTED',
TOOLS_EXTENSIONS_PROMPT_DISMISSED = 'TOOLS_EXTENSIONS.PROMPT_DISMISSED',
}

export enum PlatformErrors {
Expand Down
47 changes: 0 additions & 47 deletions src/client/telemetry/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2050,53 +2050,6 @@ export interface IEventNamePropertyMapping {
[EventName.ENVIRONMENT_CHECK_RESULT]: {
result: 'criteria-met' | 'criteria-not-met' | 'already-ran' | 'turned-off' | 'no-uri';
};
/**
* Telemetry event sent when a linter or formatter extension is already installed.
*/
/* __GDPR__
"tools_extensions.already_installed" : {
"extensionId" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "owner": "karthiknadig" }
}
*/
[EventName.TOOLS_EXTENSIONS_ALREADY_INSTALLED]: {
extensionId: 'ms-python.pylint' | 'ms-python.flake8';
isEnabled: boolean;
};
/**
* Telemetry event sent when install linter or formatter extension prompt is shown.
*/
/* __GDPR__
"tools_extensions.prompt_shown" : {
"extensionId" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "owner": "karthiknadig" }
}
*/
[EventName.TOOLS_EXTENSIONS_PROMPT_SHOWN]: {
extensionId: 'ms-python.pylint' | 'ms-python.flake8';
};
/**
* Telemetry event sent when clicking to install linter or formatter extension from the suggestion prompt.
*/
/* __GDPR__
"tools_extensions.install_selected" : {
"extensionId" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "owner": "karthiknadig" }
}
*/
[EventName.TOOLS_EXTENSIONS_INSTALL_SELECTED]: {
extensionId: 'ms-python.pylint' | 'ms-python.flake8';
};
/**
* Telemetry event sent when dismissing prompt suggesting to install the linter or formatter extension.
*/
/* __GDPR__
"tools_extensions.prompt_dismissed" : {
"extensionId" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "owner": "karthiknadig" },
"dismissType" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "owner": "karthiknadig" }
}
*/
[EventName.TOOLS_EXTENSIONS_PROMPT_DISMISSED]: {
extensionId: 'ms-python.pylint' | 'ms-python.flake8';
dismissType: 'close' | 'doNotShow';
};
/* __GDPR__
"query-expfeature" : {
"owner": "luabud",
Expand Down
11 changes: 0 additions & 11 deletions src/test/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,12 @@ export enum OSType {
export type PythonSettingKeys =
| 'defaultInterpreterPath'
| 'languageServer'
| 'linting.lintOnSave'
| 'linting.enabled'
| 'linting.pylintEnabled'
| 'linting.flake8Enabled'
| 'linting.pycodestyleEnabled'
| 'linting.pylamaEnabled'
| 'linting.prospectorEnabled'
| 'linting.pydocstyleEnabled'
| 'linting.mypyEnabled'
| 'linting.banditEnabled'
| 'testing.pytestArgs'
| 'testing.unittestArgs'
| 'formatting.provider'
| 'testing.pytestEnabled'
| 'testing.unittestEnabled'
| 'envFile'
| 'linting.ignorePatterns'
| 'terminal.activateEnvironment';

async function disposePythonSettings() {
Expand Down
2 changes: 0 additions & 2 deletions src/test/common/configSettings/configSettings.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import {
IAutoCompleteSettings,
IExperiments,
IInterpreterSettings,
ILintingSettings,
ITerminalSettings,
} from '../../../client/common/types';
import { noop } from '../../../client/common/utils/misc';
Expand Down Expand Up @@ -115,7 +114,6 @@ suite('Python Settings', async () => {

// complex settings
config.setup((c) => c.get<IInterpreterSettings>('interpreter')).returns(() => sourceSettings.interpreter);
config.setup((c) => c.get<ILintingSettings>('linting')).returns(() => sourceSettings.linting);
config.setup((c) => c.get<IAutoCompleteSettings>('autoComplete')).returns(() => sourceSettings.autoComplete);
config.setup((c) => c.get<ITestingSettings>('testing')).returns(() => sourceSettings.testing);
config.setup((c) => c.get<ITerminalSettings>('terminal')).returns(() => sourceSettings.terminal);
Expand Down
Loading

0 comments on commit 4544f19

Please sign in to comment.