Skip to content

Commit

Permalink
Remove linting support (#22266)
Browse files Browse the repository at this point in the history
  • Loading branch information
karthiknadig authored Oct 19, 2023
1 parent c82702e commit 5d7eb65
Show file tree
Hide file tree
Showing 67 changed files with 7 additions and 8,212 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
12 changes: 0 additions & 12 deletions src/client/common/installer/productPath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { inject, injectable } from 'inversify';
import * as path from 'path';
import { Uri } from 'vscode';
import { IServiceContainer } from '../../ioc/types';
import { ILinterManager } from '../../linters/types';
import { ITestingService } from '../../testing/types';
import { IConfigurationService, IInstaller, Product } from '../types';
import { IProductPathService } from './types';
Expand Down Expand Up @@ -36,17 +35,6 @@ export abstract class BaseProductPathsService implements IProductPathService {
}
}

@injectable()
export class LinterProductPathService extends BaseProductPathsService {
constructor(@inject(IServiceContainer) serviceContainer: IServiceContainer) {
super(serviceContainer);
}
public getExecutableNameFromSettings(product: Product, resource?: Uri): string {
const linterManager = this.serviceContainer.get<ILinterManager>(ILinterManager);
return linterManager.getLinterInfo(product).pathName(resource);
}
}

@injectable()
export class TestFrameworkProductPathService extends BaseProductPathsService {
constructor(@inject(IServiceContainer) serviceContainer: IServiceContainer) {
Expand Down
8 changes: 0 additions & 8 deletions src/client/common/installer/productService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,6 @@ export class ProductService implements IProductService {
private ProductTypes = new Map<Product, ProductType>();

constructor() {
this.ProductTypes.set(Product.bandit, ProductType.Linter);
this.ProductTypes.set(Product.flake8, ProductType.Linter);
this.ProductTypes.set(Product.mypy, ProductType.Linter);
this.ProductTypes.set(Product.pycodestyle, ProductType.Linter);
this.ProductTypes.set(Product.prospector, ProductType.Linter);
this.ProductTypes.set(Product.pydocstyle, ProductType.Linter);
this.ProductTypes.set(Product.pylama, ProductType.Linter);
this.ProductTypes.set(Product.pylint, ProductType.Linter);
this.ProductTypes.set(Product.pytest, ProductType.TestFramework);
this.ProductTypes.set(Product.unittest, ProductType.TestFramework);
this.ProductTypes.set(Product.tensorboard, ProductType.DataScience);
Expand Down
7 changes: 1 addition & 6 deletions src/client/common/installer/serviceRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@ import { CondaInstaller } from './condaInstaller';
import { PipEnvInstaller } from './pipEnvInstaller';
import { PipInstaller } from './pipInstaller';
import { PoetryInstaller } from './poetryInstaller';
import {
DataScienceProductPathService,
LinterProductPathService,
TestFrameworkProductPathService,
} from './productPath';
import { DataScienceProductPathService, TestFrameworkProductPathService } from './productPath';
import { ProductService } from './productService';
import { IInstallationChannelManager, IModuleInstaller, IProductPathService, IProductService } from './types';

Expand All @@ -24,7 +20,6 @@ export function registerTypes(serviceManager: IServiceManager) {
serviceManager.addSingleton<IModuleInstaller>(IModuleInstaller, PoetryInstaller);
serviceManager.addSingleton<IInstallationChannelManager>(IInstallationChannelManager, InstallationChannelManager);
serviceManager.addSingleton<IProductService>(IProductService, ProductService);
serviceManager.addSingleton<IProductPathService>(IProductPathService, LinterProductPathService, ProductType.Linter);
serviceManager.addSingleton<IProductPathService>(
IProductPathService,
TestFrameworkProductPathService,
Expand Down
69 changes: 0 additions & 69 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 @@ -85,24 +84,14 @@ export enum ProductInstallStatus {
}

export enum ProductType {
Linter = 'Linter',
TestFramework = 'TestFramework',
RefactoringLibrary = 'RefactoringLibrary',
DataScience = 'DataScience',
Python = 'Python',
}

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 @@ -179,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 @@ -197,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');
}
2 changes: 0 additions & 2 deletions src/client/extensionActivation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import { registerTypes as debugConfigurationRegisterTypes } from './debugger/ext
import { IDebugConfigurationService, IDynamicDebugConfigurationService } from './debugger/extension/types';
import { IInterpreterService } from './interpreter/contracts';
import { getLanguageConfiguration } from './language/languageConfiguration';
import { registerTypes as lintersRegisterTypes } from './linters/serviceRegistry';
import { ReplProvider } from './providers/replProvider';
import { registerTypes as providersRegisterTypes } from './providers/serviceRegistry';
import { TerminalProvider } from './providers/terminalProvider';
Expand Down Expand Up @@ -122,7 +121,6 @@ async function activateLegacy(ext: ExtensionState): Promise<ActivationResult> {
serviceManager.addSingletonInstance<boolean>(UseProposedApi, enableProposedApi);
// Feature specific registrations.
unitTestsRegisterTypes(serviceManager);
lintersRegisterTypes(serviceManager);
installerRegisterTypes(serviceManager);
commonRegisterTerminalTypes(serviceManager);
debugConfigurationRegisterTypes(serviceManager);
Expand Down
Loading

0 comments on commit 5d7eb65

Please sign in to comment.