diff --git a/.github/test_plan.md b/.github/test_plan.md index f6df3b4d74f4..5360ad471e79 100644 --- a/.github/test_plan.md +++ b/.github/test_plan.md @@ -159,7 +159,7 @@ foo = 42 # Marked as a blacklisted name. - [ ] `Select linter` lists the linter and installs it if necessary - [ ] mypy works - [ ] `Select linter` lists the linter and installs it if necessary -- [ ] pep8 works +- [ ] pycodestyle works - [ ] `Select linter` lists the linter and installs it if necessary - [ ] prospector works - [ ] `Select linter` lists the linter and installs it if necessary diff --git a/build/existingFiles.json b/build/existingFiles.json index 3fd7bc753de0..da747046f5cd 100644 --- a/build/existingFiles.json +++ b/build/existingFiles.json @@ -243,7 +243,7 @@ "src/client/linters/linterManager.ts", "src/client/linters/lintingEngine.ts", "src/client/linters/mypy.ts", - "src/client/linters/pep8.ts", + "src/client/linters/pycodestyle.ts", "src/client/linters/prospector.ts", "src/client/linters/pydocstyle.ts", "src/client/linters/pylama.ts", diff --git a/build/test-requirements.txt b/build/test-requirements.txt index f91307d3f63e..37abe5e0a827 100644 --- a/build/test-requirements.txt +++ b/build/test-requirements.txt @@ -6,7 +6,7 @@ bandit black ; python_version>='3.6' yapf pylint -pep8 +pycodestyle prospector pydocstyle nose diff --git a/data/.vscode/settings.json b/data/.vscode/settings.json index 615aafb035a1..99acc159fcaa 100644 --- a/data/.vscode/settings.json +++ b/data/.vscode/settings.json @@ -1,3 +1,3 @@ { "python.pythonPath": "/usr/bin/python3" -} \ No newline at end of file +} diff --git a/data/test.py b/data/test.py index 3691ddf33598..3b316dc1e8d1 100644 --- a/data/test.py +++ b/data/test.py @@ -1,2 +1,2 @@ #%% -print('hello') \ No newline at end of file +print('hello') diff --git a/news/2 Fixes/410.md b/news/2 Fixes/410.md new file mode 100644 index 000000000000..61e278a4c20b --- /dev/null +++ b/news/2 Fixes/410.md @@ -0,0 +1,12 @@ +# Replaced occuances of `pep8` with `pycodestyle.` + +All menntions of pep8 have been replaced with pycodestyle + +## Add script to replace outdated settings with the new ones in user settings.json + +* python.linting.pep8Args -> python.linting.pycodestyleArgs +* python.linting.pep8CategorySeverity.E -> python.linting.pycodestyleCategorySeverity.E +* python.linting.pep8CategorySeverity.W -> python.linting.pycodestyleCategorySeverity.W +* python.linting.pep8Enabled -> python.linting.pycodestyleEnabled +* python.linting.pep8Path -> python.linting.pycodestylePath +* (thanks [Marsfan](https://github.com/Marsfan)) diff --git a/package.json b/package.json index 2a1bda4e0aec..879f50f15088 100644 --- a/package.json +++ b/package.json @@ -1936,7 +1936,8 @@ "description": "Path to mypy, you can use a custom version of mypy by modifying this setting to include the full path.", "scope": "resource" }, - "python.linting.pep8Args": { + + "python.linting.pycodestyleArgs": { "type": "array", "description": "Arguments passed in. Each argument is a separate item in the array.", "default": [], @@ -1945,10 +1946,10 @@ }, "scope": "resource" }, - "python.linting.pep8CategorySeverity.E": { + "python.linting.pycodestyleCategorySeverity.E": { "type": "string", "default": "Error", - "description": "Severity of Pep8 message type 'E'.", + "description": "Severity of pycodestyle message type 'E'.", "enum": [ "Hint", "Error", @@ -1957,10 +1958,10 @@ ], "scope": "resource" }, - "python.linting.pep8CategorySeverity.W": { + "python.linting.pycodestyleCategorySeverity.W": { "type": "string", "default": "Warning", - "description": "Severity of Pep8 message type 'W'.", + "description": "Severity of pycodestyle message type 'W'.", "enum": [ "Hint", "Error", @@ -1969,16 +1970,16 @@ ], "scope": "resource" }, - "python.linting.pep8Enabled": { + "python.linting.pycodestyleEnabled": { "type": "boolean", "default": false, - "description": "Whether to lint Python files using pep8", + "description": "Whether to lint Python files using pycodestyle", "scope": "resource" }, - "python.linting.pep8Path": { + "python.linting.pycodestylePath": { "type": "string", - "default": "pep8", - "description": "Path to pep8, you can use a custom version of pep8 by modifying this setting to include the full path.", + "default": "pycodestyle", + "description": "Path to pycodestyle, you can use a custom version of pycodestyle by modifying this setting to include the full path.", "scope": "resource" }, "python.linting.prospectorArgs": { diff --git a/src/client/common/configSettings.ts b/src/client/common/configSettings.ts index 0c461c3e6a02..be1f96266110 100644 --- a/src/client/common/configSettings.ts +++ b/src/client/common/configSettings.ts @@ -209,7 +209,7 @@ export class PythonSettings implements IPythonSettings { lintOnSave: false, maxNumberOfProblems: 100, mypyArgs: [], mypyEnabled: false, mypyPath: 'mypy', banditArgs: [], banditEnabled: false, banditPath: 'bandit', - pep8Args: [], pep8Enabled: false, pep8Path: 'pep8', + pycodestyleArgs: [], pycodestyleEnabled: false, pycodestylePath: 'pycodestyle', pylamaArgs: [], pylamaEnabled: false, pylamaPath: 'pylama', prospectorArgs: [], prospectorEnabled: false, prospectorPath: 'prospector', pydocstyleArgs: [], pydocstyleEnabled: false, pydocstylePath: 'pydocstyle', @@ -221,7 +221,7 @@ export class PythonSettings implements IPythonSettings { refactor: DiagnosticSeverity.Hint, warning: DiagnosticSeverity.Warning }, - pep8CategorySeverity: { + pycodestyleCategorySeverity: { E: DiagnosticSeverity.Error, W: DiagnosticSeverity.Warning }, @@ -241,7 +241,7 @@ export class PythonSettings implements IPythonSettings { }; this.linting.pylintPath = getAbsolutePath(systemVariables.resolveAny(this.linting.pylintPath), workspaceRoot); this.linting.flake8Path = getAbsolutePath(systemVariables.resolveAny(this.linting.flake8Path), workspaceRoot); - this.linting.pep8Path = getAbsolutePath(systemVariables.resolveAny(this.linting.pep8Path), 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); diff --git a/src/client/common/installer/productInstaller.ts b/src/client/common/installer/productInstaller.ts index 37e534903cd6..ced2e3500c9e 100644 --- a/src/client/common/installer/productInstaller.ts +++ b/src/client/common/installer/productInstaller.ts @@ -337,7 +337,7 @@ function translateProductToModule(product: Product, purpose: ModuleNamePurpose): case Product.pytest: return 'pytest'; case Product.autopep8: return 'autopep8'; case Product.black: return 'black'; - case Product.pep8: return 'pep8'; + case Product.pycodestyle: return 'pycodestyle'; case Product.pydocstyle: return 'pydocstyle'; case Product.yapf: return 'yapf'; case Product.flake8: return 'flake8'; diff --git a/src/client/common/installer/productNames.ts b/src/client/common/installer/productNames.ts index 43004aa82e1b..4b7deae43dec 100644 --- a/src/client/common/installer/productNames.ts +++ b/src/client/common/installer/productNames.ts @@ -11,7 +11,7 @@ ProductNames.set(Product.black, 'black'); ProductNames.set(Product.flake8, 'flake8'); ProductNames.set(Product.mypy, 'mypy'); ProductNames.set(Product.nosetest, 'nosetest'); -ProductNames.set(Product.pep8, 'pep8'); +ProductNames.set(Product.pycodestyle, 'pycodestyle'); ProductNames.set(Product.pylama, 'pylama'); ProductNames.set(Product.prospector, 'prospector'); ProductNames.set(Product.pydocstyle, 'pydocstyle'); diff --git a/src/client/common/installer/productService.ts b/src/client/common/installer/productService.ts index 98a2f190956d..c6a3756cafe0 100644 --- a/src/client/common/installer/productService.ts +++ b/src/client/common/installer/productService.ts @@ -15,7 +15,7 @@ export class ProductService implements IProductService { 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.pep8, 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); diff --git a/src/client/common/types.ts b/src/client/common/types.ts index 4c38857eb71e..82381e14dcfd 100644 --- a/src/client/common/types.ts +++ b/src/client/common/types.ts @@ -84,7 +84,7 @@ export enum Product { nosetest = 2, pylint = 3, flake8 = 4, - pep8 = 5, + pycodestyle = 5, pylama = 6, prospector = 7, pydocstyle = 8, @@ -199,7 +199,7 @@ export interface IPylintCategorySeverity { readonly error: DiagnosticSeverity; readonly fatal: DiagnosticSeverity; } -export interface IPep8CategorySeverity { +export interface IPycodestyleCategorySeverity { readonly W: DiagnosticSeverity; readonly E: DiagnosticSeverity; } @@ -220,8 +220,8 @@ export interface ILintingSettings { readonly prospectorArgs: string[]; readonly pylintEnabled: boolean; readonly pylintArgs: string[]; - readonly pep8Enabled: boolean; - readonly pep8Args: string[]; + readonly pycodestyleEnabled: boolean; + readonly pycodestyleArgs: string[]; readonly pylamaEnabled: boolean; readonly pylamaArgs: string[]; readonly flake8Enabled: boolean; @@ -231,12 +231,12 @@ export interface ILintingSettings { readonly lintOnSave: boolean; readonly maxNumberOfProblems: number; readonly pylintCategorySeverity: IPylintCategorySeverity; - readonly pep8CategorySeverity: IPep8CategorySeverity; + readonly pycodestyleCategorySeverity: IPycodestyleCategorySeverity; readonly flake8CategorySeverity: Flake8CategorySeverity; readonly mypyCategorySeverity: IMypyCategorySeverity; prospectorPath: string; pylintPath: string; - pep8Path: string; + pycodestylePath: string; pylamaPath: string; flake8Path: string; pydocstylePath: string; diff --git a/src/client/linters/constants.ts b/src/client/linters/constants.ts index a3067c2eead6..af4f6c4b2509 100644 --- a/src/client/linters/constants.ts +++ b/src/client/linters/constants.ts @@ -12,7 +12,7 @@ export const LINTERID_BY_PRODUCT = new Map([ [Product.flake8, 'flake8'], [Product.pylint, 'pylint'], [Product.mypy, 'mypy'], - [Product.pep8, 'pep8'], + [Product.pycodestyle, 'pycodestyle'], [Product.prospector, 'prospector'], [Product.pydocstyle, 'pydocstyle'], [Product.pylama, 'pylama'] diff --git a/src/client/linters/linterManager.ts b/src/client/linters/linterManager.ts index 7b133b88f51e..4ebeb74e769f 100644 --- a/src/client/linters/linterManager.ts +++ b/src/client/linters/linterManager.ts @@ -16,8 +16,8 @@ import { Bandit } from './bandit'; import { Flake8 } from './flake8'; import { LinterInfo, PylintLinterInfo } from './linterInfo'; import { MyPy } from './mypy'; -import { Pep8 } from './pep8'; import { Prospector } from './prospector'; +import { Pycodestyle } from './pycodestyle'; import { PyDocStyle } from './pydocstyle'; import { PyLama } from './pylama'; import { Pylint } from './pylint'; @@ -54,7 +54,7 @@ export class LinterManager implements ILinterManager { new LinterInfo(Product.flake8, 'flake8', this.configService), new PylintLinterInfo(this.configService, this.workspaceService, ['.pylintrc', 'pylintrc']), new LinterInfo(Product.mypy, 'mypy', this.configService), - new LinterInfo(Product.pep8, 'pep8', this.configService), + new LinterInfo(Product.pycodestyle, 'pycodestyle', this.configService), new LinterInfo(Product.prospector, 'prospector', this.configService), new LinterInfo(Product.pydocstyle, 'pydocstyle', this.configService), new LinterInfo(Product.pylama, 'pylama', this.configService) @@ -134,8 +134,8 @@ export class LinterManager implements ILinterManager { return new PyLama(outputChannel, serviceContainer); case Product.pydocstyle: return new PyDocStyle(outputChannel, serviceContainer); - case Product.pep8: - return new Pep8(outputChannel, serviceContainer); + case Product.pycodestyle: + return new Pycodestyle(outputChannel, serviceContainer); default: serviceContainer.get(ILogger).logError(error); break; diff --git a/src/client/linters/pep8.ts b/src/client/linters/pycodestyle.ts similarity index 80% rename from src/client/linters/pep8.ts rename to src/client/linters/pycodestyle.ts index 959923c6ad5e..250a3fedfda8 100644 --- a/src/client/linters/pep8.ts +++ b/src/client/linters/pycodestyle.ts @@ -7,15 +7,15 @@ import { ILintMessage } from './types'; const COLUMN_OFF_SET = 1; -export class Pep8 extends BaseLinter { +export class Pycodestyle extends BaseLinter { constructor(outputChannel: OutputChannel, serviceContainer: IServiceContainer) { - super(Product.pep8, outputChannel, serviceContainer, COLUMN_OFF_SET); + super(Product.pycodestyle, outputChannel, serviceContainer, COLUMN_OFF_SET); } protected async runLinter(document: TextDocument, cancellation: CancellationToken): Promise { const messages = await this.run(['--format=%(row)d,%(col)d,%(code).1s,%(code)s:%(text)s', document.uri.fsPath], document, cancellation); messages.forEach(msg => { - msg.severity = this.parseMessagesSeverity(msg.type, this.pythonSettings.linting.pep8CategorySeverity); + msg.severity = this.parseMessagesSeverity(msg.type, this.pythonSettings.linting.pycodestyleCategorySeverity); }); return messages; } diff --git a/src/client/linters/types.ts b/src/client/linters/types.ts index 1bc0a4128b30..4fa6f7c9c4de 100644 --- a/src/client/linters/types.ts +++ b/src/client/linters/types.ts @@ -13,7 +13,7 @@ export interface IErrorHandler { // tslint:disable-next-line:no-suspicious-comment // TODO: Use an enum for LinterID instead of a union of string literals. -export type LinterId = 'flake8' | 'mypy' | 'pep8' | 'prospector' | 'pydocstyle' | 'pylama' | 'pylint' | 'bandit'; +export type LinterId = 'flake8' | 'mypy' | 'pycodestyle' | 'prospector' | 'pydocstyle' | 'pylama' | 'pylint' | 'bandit'; export interface ILinterInfo { readonly id: LinterId; diff --git a/src/client/testing/common/updateTestSettings.ts b/src/client/testing/common/updateTestSettings.ts index 866ff4939c72..6e55ffe00899 100644 --- a/src/client/testing/common/updateTestSettings.ts +++ b/src/client/testing/common/updateTestSettings.ts @@ -49,25 +49,41 @@ export class UpdateTestSettingService implements IExtensionActivationService { @swallowExceptions('Failed to update settings.json') public async fixSettingInFile(filePath: string) { let fileContents = await this.fs.readFile(filePath); - const setting = new RegExp('"python.unitTest', 'g'); - const setting_pytest_enabled = new RegExp('.pyTestEnabled"', 'g'); - const setting_pytest_args = new RegExp('.pyTestArgs"', 'g'); - const setting_pytest_path = new RegExp('.pyTestPath"', 'g'); - const setting_microsoftLanguageServer = new RegExp('.languageServer": "microsoft"', 'g'); - const setting_JediLanguageServer = new RegExp('.languageServer": "jedi"', 'g'); + const setting = new RegExp('"python\\.unitTest', 'g'); fileContents = fileContents.replace(setting, '"python.testing'); + + const setting_pytest_enabled = new RegExp('\\.pyTestEnabled"', 'g'); + const setting_pytest_args = new RegExp('\\.pyTestArgs"', 'g'); + const setting_pytest_path = new RegExp('\\.pyTestPath"', 'g'); fileContents = fileContents.replace(setting_pytest_enabled, '.pytestEnabled"'); fileContents = fileContents.replace(setting_pytest_args, '.pytestArgs"'); fileContents = fileContents.replace(setting_pytest_path, '.pytestPath"'); + + const setting_microsoftLanguageServer = new RegExp('\\.languageServer": "microsoft"', 'g'); + const setting_JediLanguageServer = new RegExp('\\.languageServer": "jedi"', 'g'); fileContents = fileContents.replace(setting_microsoftLanguageServer, '.jediEnabled": false'); fileContents = fileContents.replace(setting_JediLanguageServer, '.jediEnabled": true'); + + const setting_pep8_args = new RegExp('\\.(? 0 || contents.indexOf('.pyTest') > 0; + return ( + contents.indexOf('python.unitTest.') > 0 || + contents.indexOf('.pyTest') > 0 || + contents.indexOf('.pep8') > 0 + ); } catch (ex) { traceError('Failed to check if file needs to be fixed', ex); return false; diff --git a/src/test/.vscode/settings.json b/src/test/.vscode/settings.json index a20077c2b735..f78fa68d8fd7 100644 --- a/src/test/.vscode/settings.json +++ b/src/test/.vscode/settings.json @@ -11,7 +11,7 @@ "python.sortImports.args": [], "python.linting.lintOnSave": false, "python.linting.enabled": true, - "python.linting.pep8Enabled": false, + "python.linting.pycodestyleEnabled": false, "python.linting.prospectorEnabled": false, "python.linting.pydocstyleEnabled": false, "python.linting.pylamaEnabled": false, diff --git a/src/test/.vscode/tags b/src/test/.vscode/tags index c4371e74af04..9a1d17ca7111 100644 --- a/src/test/.vscode/tags +++ b/src/test/.vscode/tags @@ -48,7 +48,7 @@ Foo ..\\pythonFiles\\autocomp\\four.py /^class Foo(object):$/;" kind:class line: Foo ..\\pythonFiles\\definition\\four.py /^class Foo(object):$/;" kind:class line:7 Foo ..\\pythonFiles\\linting\\file.py /^class Foo(object):$/;" kind:class line:5 Foo ..\\pythonFiles\\linting\\flake8config\\file.py /^class Foo(object):$/;" kind:class line:5 -Foo ..\\pythonFiles\\linting\\pep8config\\file.py /^class Foo(object):$/;" kind:class line:5 +Foo ..\\pythonFiles\\linting\\pycodestyleconfig\\file.py /^class Foo(object):$/;" kind:class line:5 Foo ..\\pythonFiles\\linting\\pydocstyleconfig27\\file.py /^class Foo(object):$/;" kind:class line:5 Foo ..\\pythonFiles\\linting\\pylintconfig\\file.py /^class Foo(object):$/;" kind:class line:5 Foo ..\\pythonFiles\\symbolFiles\\file.py /^class Foo(object):$/;" kind:class line:5 @@ -160,7 +160,7 @@ __init__ ..\\pythonFiles\\formatting\\fileToFormat.py /^ def __init__ ( se __init__ ..\\pythonFiles\\jupyter\\cells.py /^ def __init__(self, mean=0.0, std=1, size=1000):$/;" kind:member line:104 __init__ ..\\pythonFiles\\linting\\file.py /^ def __init__(self):$/;" kind:member line:8 __init__ ..\\pythonFiles\\linting\\flake8config\\file.py /^ def __init__(self):$/;" kind:member line:8 -__init__ ..\\pythonFiles\\linting\\pep8config\\file.py /^ def __init__(self):$/;" kind:member line:8 +__init__ ..\\pythonFiles\\linting\\pycodestyleconfig\\file.py /^ def __init__(self):$/;" kind:member line:8 __init__ ..\\pythonFiles\\linting\\pydocstyleconfig27\\file.py /^ def __init__(self):$/;" kind:member line:8 __init__ ..\\pythonFiles\\linting\\pylintconfig\\file.py /^ def __init__(self):$/;" kind:member line:8 __init__ ..\\pythonFiles\\refactoring\\standAlone\\refactor.py /^ def __init__(self):$/;" kind:member line:164 @@ -186,7 +186,7 @@ __revision__ ..\\multiRootWkspc\\workspace2\\file.py /^__revision__ = None$/;" k __revision__ ..\\multiRootWkspc\\workspace3\\file.py /^__revision__ = None$/;" kind:variable line:3 __revision__ ..\\pythonFiles\\linting\\file.py /^__revision__ = None$/;" kind:variable line:3 __revision__ ..\\pythonFiles\\linting\\flake8config\\file.py /^__revision__ = None$/;" kind:variable line:3 -__revision__ ..\\pythonFiles\\linting\\pep8config\\file.py /^__revision__ = None$/;" kind:variable line:3 +__revision__ ..\\pythonFiles\\linting\\pycodestyleconfig\\file.py /^__revision__ = None$/;" kind:variable line:3 __revision__ ..\\pythonFiles\\linting\\pydocstyleconfig27\\file.py /^__revision__ = None$/;" kind:variable line:3 __revision__ ..\\pythonFiles\\linting\\pylintconfig\\file.py /^__revision__ = None$/;" kind:variable line:3 __revision__ ..\\pythonFiles\\symbolFiles\\childFile.py /^__revision__ = None$/;" kind:variable line:3 @@ -322,7 +322,7 @@ file.py ..\\multiRootWkspc\\workspace2\\file.py 1;" kind:file line:1 file.py ..\\multiRootWkspc\\workspace3\\file.py 1;" kind:file line:1 file.py ..\\pythonFiles\\linting\\file.py 1;" kind:file line:1 file.py ..\\pythonFiles\\linting\\flake8config\\file.py 1;" kind:file line:1 -file.py ..\\pythonFiles\\linting\\pep8config\\file.py 1;" kind:file line:1 +file.py ..\\pythonFiles\\linting\\pycodestyleconfig\\file.py 1;" kind:file line:1 file.py ..\\pythonFiles\\linting\\pydocstyleconfig27\\file.py 1;" kind:file line:1 file.py ..\\pythonFiles\\linting\\pylintconfig\\file.py 1;" kind:file line:1 file.py ..\\pythonFiles\\symbolFiles\\file.py 1;" kind:file line:1 @@ -365,7 +365,7 @@ meth1 ..\\multiRootWkspc\\workspace2\\file.py /^ def meth1(self, arg):$/;" ki meth1 ..\\multiRootWkspc\\workspace3\\file.py /^ def meth1(self, arg):$/;" kind:member line:11 meth1 ..\\pythonFiles\\linting\\file.py /^ def meth1(self, arg):$/;" kind:member line:11 meth1 ..\\pythonFiles\\linting\\flake8config\\file.py /^ def meth1(self, arg):$/;" kind:member line:11 -meth1 ..\\pythonFiles\\linting\\pep8config\\file.py /^ def meth1(self, arg):$/;" kind:member line:11 +meth1 ..\\pythonFiles\\linting\\pycodestyleconfig\\file.py /^ def meth1(self, arg):$/;" kind:member line:11 meth1 ..\\pythonFiles\\linting\\pydocstyleconfig27\\file.py /^ def meth1(self, arg):$/;" kind:member line:11 meth1 ..\\pythonFiles\\linting\\pylintconfig\\file.py /^ def meth1(self, arg):$/;" kind:member line:11 meth1 ..\\pythonFiles\\symbolFiles\\file.py /^ def meth1(self, arg):$/;" kind:member line:11 @@ -378,7 +378,7 @@ meth2 ..\\multiRootWkspc\\workspace2\\file.py /^ def meth2(self, arg):$/;" ki meth2 ..\\multiRootWkspc\\workspace3\\file.py /^ def meth2(self, arg):$/;" kind:member line:15 meth2 ..\\pythonFiles\\linting\\file.py /^ def meth2(self, arg):$/;" kind:member line:15 meth2 ..\\pythonFiles\\linting\\flake8config\\file.py /^ def meth2(self, arg):$/;" kind:member line:15 -meth2 ..\\pythonFiles\\linting\\pep8config\\file.py /^ def meth2(self, arg):$/;" kind:member line:15 +meth2 ..\\pythonFiles\\linting\\pycodestyleconfig\\file.py /^ def meth2(self, arg):$/;" kind:member line:15 meth2 ..\\pythonFiles\\linting\\pydocstyleconfig27\\file.py /^ def meth2(self, arg):$/;" kind:member line:15 meth2 ..\\pythonFiles\\linting\\pylintconfig\\file.py /^ def meth2(self, arg):$/;" kind:member line:15 meth2 ..\\pythonFiles\\symbolFiles\\file.py /^ def meth2(self, arg):$/;" kind:member line:15 @@ -389,7 +389,7 @@ meth3 ..\\multiRootWkspc\\workspace2\\file.py /^ def meth3(self):$/;" kind:me meth3 ..\\multiRootWkspc\\workspace3\\file.py /^ def meth3(self):$/;" kind:member line:21 meth3 ..\\pythonFiles\\linting\\file.py /^ def meth3(self):$/;" kind:member line:21 meth3 ..\\pythonFiles\\linting\\flake8config\\file.py /^ def meth3(self):$/;" kind:member line:21 -meth3 ..\\pythonFiles\\linting\\pep8config\\file.py /^ def meth3(self):$/;" kind:member line:21 +meth3 ..\\pythonFiles\\linting\\pycodestyleconfig\\file.py /^ def meth3(self):$/;" kind:member line:21 meth3 ..\\pythonFiles\\linting\\pydocstyleconfig27\\file.py /^ def meth3(self):$/;" kind:member line:21 meth3 ..\\pythonFiles\\linting\\pylintconfig\\file.py /^ def meth3(self):$/;" kind:member line:21 meth3 ..\\pythonFiles\\symbolFiles\\file.py /^ def meth3(self):$/;" kind:member line:21 @@ -400,7 +400,7 @@ meth4 ..\\multiRootWkspc\\workspace2\\file.py /^ def meth4(self):$/;" kind:me meth4 ..\\multiRootWkspc\\workspace3\\file.py /^ def meth4(self):$/;" kind:member line:28 meth4 ..\\pythonFiles\\linting\\file.py /^ def meth4(self):$/;" kind:member line:28 meth4 ..\\pythonFiles\\linting\\flake8config\\file.py /^ def meth4(self):$/;" kind:member line:28 -meth4 ..\\pythonFiles\\linting\\pep8config\\file.py /^ def meth4(self):$/;" kind:member line:28 +meth4 ..\\pythonFiles\\linting\\pycodestyleconfig\\file.py /^ def meth4(self):$/;" kind:member line:28 meth4 ..\\pythonFiles\\linting\\pydocstyleconfig27\\file.py /^ def meth4(self):$/;" kind:member line:28 meth4 ..\\pythonFiles\\linting\\pylintconfig\\file.py /^ def meth4(self):$/;" kind:member line:28 meth4 ..\\pythonFiles\\symbolFiles\\file.py /^ def meth4(self):$/;" kind:member line:28 @@ -411,7 +411,7 @@ meth5 ..\\multiRootWkspc\\workspace2\\file.py /^ def meth5(self):$/;" kind:me meth5 ..\\multiRootWkspc\\workspace3\\file.py /^ def meth5(self):$/;" kind:member line:38 meth5 ..\\pythonFiles\\linting\\file.py /^ def meth5(self):$/;" kind:member line:38 meth5 ..\\pythonFiles\\linting\\flake8config\\file.py /^ def meth5(self):$/;" kind:member line:38 -meth5 ..\\pythonFiles\\linting\\pep8config\\file.py /^ def meth5(self):$/;" kind:member line:38 +meth5 ..\\pythonFiles\\linting\\pycodestyleconfig\\file.py /^ def meth5(self):$/;" kind:member line:38 meth5 ..\\pythonFiles\\linting\\pydocstyleconfig27\\file.py /^ def meth5(self):$/;" kind:member line:38 meth5 ..\\pythonFiles\\linting\\pylintconfig\\file.py /^ def meth5(self):$/;" kind:member line:38 meth5 ..\\pythonFiles\\symbolFiles\\file.py /^ def meth5(self):$/;" kind:member line:38 @@ -422,7 +422,7 @@ meth6 ..\\multiRootWkspc\\workspace2\\file.py /^ def meth6(self):$/;" kind:me meth6 ..\\multiRootWkspc\\workspace3\\file.py /^ def meth6(self):$/;" kind:member line:53 meth6 ..\\pythonFiles\\linting\\file.py /^ def meth6(self):$/;" kind:member line:53 meth6 ..\\pythonFiles\\linting\\flake8config\\file.py /^ def meth6(self):$/;" kind:member line:53 -meth6 ..\\pythonFiles\\linting\\pep8config\\file.py /^ def meth6(self):$/;" kind:member line:53 +meth6 ..\\pythonFiles\\linting\\pycodestyleconfig\\file.py /^ def meth6(self):$/;" kind:member line:53 meth6 ..\\pythonFiles\\linting\\pydocstyleconfig27\\file.py /^ def meth6(self):$/;" kind:member line:53 meth6 ..\\pythonFiles\\linting\\pylintconfig\\file.py /^ def meth6(self):$/;" kind:member line:53 meth6 ..\\pythonFiles\\symbolFiles\\file.py /^ def meth6(self):$/;" kind:member line:53 @@ -433,7 +433,7 @@ meth7 ..\\multiRootWkspc\\workspace2\\file.py /^ def meth7(self):$/;" kind:me meth7 ..\\multiRootWkspc\\workspace3\\file.py /^ def meth7(self):$/;" kind:member line:68 meth7 ..\\pythonFiles\\linting\\file.py /^ def meth7(self):$/;" kind:member line:68 meth7 ..\\pythonFiles\\linting\\flake8config\\file.py /^ def meth7(self):$/;" kind:member line:68 -meth7 ..\\pythonFiles\\linting\\pep8config\\file.py /^ def meth7(self):$/;" kind:member line:68 +meth7 ..\\pythonFiles\\linting\\pycodestyleconfig\\file.py /^ def meth7(self):$/;" kind:member line:68 meth7 ..\\pythonFiles\\linting\\pydocstyleconfig27\\file.py /^ def meth7(self):$/;" kind:member line:68 meth7 ..\\pythonFiles\\linting\\pylintconfig\\file.py /^ def meth7(self):$/;" kind:member line:68 meth7 ..\\pythonFiles\\symbolFiles\\file.py /^ def meth7(self):$/;" kind:member line:68 @@ -444,7 +444,7 @@ meth8 ..\\multiRootWkspc\\workspace2\\file.py /^ def meth8(self):$/;" kind:me meth8 ..\\multiRootWkspc\\workspace3\\file.py /^ def meth8(self):$/;" kind:member line:80 meth8 ..\\pythonFiles\\linting\\file.py /^ def meth8(self):$/;" kind:member line:80 meth8 ..\\pythonFiles\\linting\\flake8config\\file.py /^ def meth8(self):$/;" kind:member line:80 -meth8 ..\\pythonFiles\\linting\\pep8config\\file.py /^ def meth8(self):$/;" kind:member line:80 +meth8 ..\\pythonFiles\\linting\\pycodestyleconfig\\file.py /^ def meth8(self):$/;" kind:member line:80 meth8 ..\\pythonFiles\\linting\\pydocstyleconfig27\\file.py /^ def meth8(self):$/;" kind:member line:80 meth8 ..\\pythonFiles\\linting\\pylintconfig\\file.py /^ def meth8(self):$/;" kind:member line:80 meth8 ..\\pythonFiles\\symbolFiles\\file.py /^ def meth8(self):$/;" kind:member line:80 diff --git a/src/test/common.ts b/src/test/common.ts index 1a32f4128104..a5172832b799 100644 --- a/src/test/common.ts +++ b/src/test/common.ts @@ -44,7 +44,7 @@ export enum OSType { export type PythonSettingKeys = 'workspaceSymbols.enabled' | 'pythonPath' | 'linting.lintOnSave' | 'linting.enabled' | 'linting.pylintEnabled' | - 'linting.flake8Enabled' | 'linting.pep8Enabled' | 'linting.pylamaEnabled' | + 'linting.flake8Enabled' | 'linting.pycodestyleEnabled' | 'linting.pylamaEnabled' | 'linting.prospectorEnabled' | 'linting.pydocstyleEnabled' | 'linting.mypyEnabled' | 'linting.banditEnabled' | 'testing.nosetestArgs' | 'testing.pytestArgs' | 'testing.unittestArgs' | 'formatting.provider' | 'sortImports.args' | diff --git a/src/test/linters/common.ts b/src/test/linters/common.ts index 995a7b27da78..b9967be94351 100644 --- a/src/test/linters/common.ts +++ b/src/test/linters/common.ts @@ -31,7 +31,7 @@ import { ILogger, IMypyCategorySeverity, IOutputChannel, - IPep8CategorySeverity, + IPycodestyleCategorySeverity, IPylintCategorySeverity, IPythonSettings } from '../../client/common/types'; @@ -95,8 +95,8 @@ export class LintingSettings { public prospectorArgs: string[]; public pylintEnabled: boolean; public pylintArgs: string[]; - public pep8Enabled: boolean; - public pep8Args: string[]; + public pycodestyleEnabled: boolean; + public pycodestyleArgs: string[]; public pylamaEnabled: boolean; public pylamaArgs: string[]; public flake8Enabled: boolean; @@ -106,12 +106,12 @@ export class LintingSettings { public lintOnSave: boolean; public maxNumberOfProblems: number; public pylintCategorySeverity: IPylintCategorySeverity; - public pep8CategorySeverity: IPep8CategorySeverity; + public pycodestyleCategorySeverity: IPycodestyleCategorySeverity; public flake8CategorySeverity: Flake8CategorySeverity; public mypyCategorySeverity: IMypyCategorySeverity; public prospectorPath: string; public pylintPath: string; - public pep8Path: string; + public pycodestylePath: string; public pylamaPath: string; public flake8Path: string; public pydocstylePath: string; @@ -152,10 +152,10 @@ export class LintingSettings { this.banditPath = 'bandit'; this.banditArgs = []; - this.pep8Enabled = false; - this.pep8Path = 'pep8'; - this.pep8Args = []; - this.pep8CategorySeverity = { + this.pycodestyleEnabled = false; + this.pycodestylePath = 'pycodestyle'; + this.pycodestyleArgs = []; + this.pycodestyleCategorySeverity = { E: DiagnosticSeverity.Error, W: DiagnosticSeverity.Warning }; diff --git a/src/test/linters/lint.args.test.ts b/src/test/linters/lint.args.test.ts index c722928338ad..d922c416b40f 100644 --- a/src/test/linters/lint.args.test.ts +++ b/src/test/linters/lint.args.test.ts @@ -23,8 +23,8 @@ import { BaseLinter } from '../../client/linters/baseLinter'; import { Flake8 } from '../../client/linters/flake8'; import { LinterManager } from '../../client/linters/linterManager'; import { MyPy } from '../../client/linters/mypy'; -import { Pep8 } from '../../client/linters/pep8'; import { Prospector } from '../../client/linters/prospector'; +import { Pycodestyle } from '../../client/linters/pycodestyle'; import { PyDocStyle } from '../../client/linters/pydocstyle'; import { PyLama } from '../../client/linters/pylama'; import { Pylint } from '../../client/linters/pylint'; @@ -119,8 +119,8 @@ suite('Linting - Arguments', () => { const expectedArgs = ['--format=%(row)d,%(col)d,%(code).1s,%(code)s:%(text)s', fileUri.fsPath]; await testLinter(linter, expectedArgs); }); - test('Pep8', async () => { - const linter = new Pep8(outputChannel.object, serviceContainer); + test('Pycodestyle', async () => { + const linter = new Pycodestyle(outputChannel.object, serviceContainer); const expectedArgs = ['--format=%(row)d,%(col)d,%(code).1s,%(code)s:%(text)s', fileUri.fsPath]; await testLinter(linter, expectedArgs); }); diff --git a/src/test/linters/lint.functional.test.ts b/src/test/linters/lint.functional.test.ts index f2dc06456ad7..dcafeb0b7e3d 100644 --- a/src/test/linters/lint.functional.test.ts +++ b/src/test/linters/lint.functional.test.ts @@ -58,7 +58,7 @@ const fileToLint = path.join(pythonFilesDir, 'file.py'); const linterConfigDirs = new Map([ ['flake8', path.join(pythonFilesDir, 'flake8config')], - ['pep8', path.join(pythonFilesDir, 'pep8config')], + ['pycodestyle', path.join(pythonFilesDir, 'pycodestyleconfig')], ['pydocstyle', path.join(pythonFilesDir, 'pydocstyleconfig27')], ['pylint', path.join(pythonFilesDir, 'pylintconfig')] ]); @@ -98,7 +98,7 @@ const flake8MessagesToBeReturned: ILintMessage[] = [ { line: 80, column: 5, severity: LintMessageSeverity.Error, code: 'E303', message: 'too many blank lines (2)', provider: '', type: 'E' }, { line: 87, column: 24, severity: LintMessageSeverity.Warning, code: 'W292', message: 'no newline at end of file', provider: '', type: 'E' } ]; -const pep8MessagesToBeReturned: ILintMessage[] = [ +const pycodestyleMessagesToBeReturned: ILintMessage[] = [ { line: 5, column: 1, severity: LintMessageSeverity.Error, code: 'E302', message: 'expected 2 blank lines, found 1', provider: '', type: 'E' }, { line: 19, column: 15, severity: LintMessageSeverity.Error, code: 'E127', message: 'continuation line over-indented for visual indent', provider: '', type: 'E' }, { line: 24, column: 23, severity: LintMessageSeverity.Error, code: 'E261', message: 'at least two spaces before inline comment', provider: '', type: 'E' }, @@ -133,7 +133,7 @@ const pydocstyleMessagesToBeReturned: ILintMessage[] = [ const filteredFlake8MessagesToBeReturned: ILintMessage[] = [ { line: 87, column: 24, severity: LintMessageSeverity.Warning, code: 'W292', message: 'no newline at end of file', provider: '', type: '' } ]; -const filteredPep8MessagesToBeReturned: ILintMessage[] = [ +const filteredPycodestyleMessagesToBeReturned: ILintMessage[] = [ { line: 87, column: 24, severity: LintMessageSeverity.Warning, code: 'W292', message: 'no newline at end of file', provider: '', type: '' } ]; @@ -145,8 +145,8 @@ function getMessages(product: Product): ILintMessage[] { case Product.flake8: { return flake8MessagesToBeReturned; } - case Product.pep8: { - return pep8MessagesToBeReturned; + case Product.pycodestyle: { + return pycodestyleMessagesToBeReturned; } case Product.pydocstyle: { return pydocstyleMessagesToBeReturned; @@ -170,8 +170,8 @@ async function getInfoForConfig(product: Product) { messagesToBeReceived = filteredFlake8MessagesToBeReturned; break; } - case Product.pep8: { - messagesToBeReceived = filteredPep8MessagesToBeReturned; + case Product.pycodestyle: { + messagesToBeReceived = filteredPycodestyleMessagesToBeReturned; break; } default: { break; } diff --git a/src/test/linters/lint.unit.test.ts b/src/test/linters/lint.unit.test.ts index 5832764fef50..7fb81f4aa582 100644 --- a/src/test/linters/lint.unit.test.ts +++ b/src/test/linters/lint.unit.test.ts @@ -67,7 +67,7 @@ const flake8MessagesToBeReturned: ILintMessage[] = [ { line: 80, column: 5, severity: LintMessageSeverity.Error, code: 'E303', message: 'too many blank lines (2)', provider: '', type: 'E' }, { line: 87, column: 24, severity: LintMessageSeverity.Warning, code: 'W292', message: 'no newline at end of file', provider: '', type: 'E' } ]; -const pep8MessagesToBeReturned: ILintMessage[] = [ +const pycodestyleMessagesToBeReturned: ILintMessage[] = [ { line: 5, column: 1, severity: LintMessageSeverity.Error, code: 'E302', message: 'expected 2 blank lines, found 1', provider: '', type: 'E' }, { line: 19, column: 15, severity: LintMessageSeverity.Error, code: 'E127', message: 'continuation line over-indented for visual indent', provider: '', type: 'E' }, { line: 24, column: 23, severity: LintMessageSeverity.Error, code: 'E261', message: 'at least two spaces before inline comment', provider: '', type: 'E' }, @@ -168,8 +168,8 @@ class TestFixture extends BaseTestFixture { messages = flake8MessagesToBeReturned; break; } - case Product.pep8: { - messages = pep8MessagesToBeReturned; + case Product.pycodestyle: { + messages = pycodestyleMessagesToBeReturned; break; } case Product.pydocstyle: { diff --git a/src/test/mockClasses.ts b/src/test/mockClasses.ts index a479a7dc64df..32ed3e60fcf7 100644 --- a/src/test/mockClasses.ts +++ b/src/test/mockClasses.ts @@ -1,7 +1,7 @@ import * as vscode from 'vscode'; import { Flake8CategorySeverity, ILintingSettings, IMypyCategorySeverity, - IPep8CategorySeverity, IPylintCategorySeverity + IPycodestyleCategorySeverity, IPylintCategorySeverity } from '../client/common/types'; export class MockOutputChannel implements vscode.OutputChannel { @@ -56,8 +56,8 @@ export class MockLintingSettings implements ILintingSettings { public prospectorArgs!: string[]; public pylintEnabled!: boolean; public pylintArgs!: string[]; - public pep8Enabled!: boolean; - public pep8Args!: string[]; + public pycodestyleEnabled!: boolean; + public pycodestyleArgs!: string[]; public pylamaEnabled!: boolean; public pylamaArgs!: string[]; public flake8Enabled!: boolean; @@ -67,12 +67,12 @@ export class MockLintingSettings implements ILintingSettings { public lintOnSave!: boolean; public maxNumberOfProblems!: number; public pylintCategorySeverity!: IPylintCategorySeverity; - public pep8CategorySeverity!: IPep8CategorySeverity; + public pycodestyleCategorySeverity!: IPycodestyleCategorySeverity; public flake8CategorySeverity!: Flake8CategorySeverity; public mypyCategorySeverity!: IMypyCategorySeverity; public prospectorPath!: string; public pylintPath!: string; - public pep8Path!: string; + public pycodestylePath!: string; public pylamaPath!: string; public flake8Path!: string; public pydocstylePath!: string; diff --git a/src/test/multiRootWkspc/multi.code-workspace b/src/test/multiRootWkspc/multi.code-workspace index 2bc223410653..6a9901d9df65 100644 --- a/src/test/multiRootWkspc/multi.code-workspace +++ b/src/test/multiRootWkspc/multi.code-workspace @@ -23,7 +23,7 @@ "python.linting.pydocstyleEnabled": true, "python.linting.pylamaEnabled": true, "python.linting.pylintEnabled": false, - "python.linting.pep8Enabled": true, + "python.linting.pycodestyleEnabled": true, "python.linting.prospectorEnabled": true, "python.workspaceSymbols.enabled": true } diff --git a/src/test/pythonFiles/linting/pep8config/.pep8 b/src/test/pythonFiles/linting/pep8config/.pep8 deleted file mode 100644 index 40c4dff4d14b..000000000000 --- a/src/test/pythonFiles/linting/pep8config/.pep8 +++ /dev/null @@ -1,2 +0,0 @@ -[pep8] -ignore = E302,E901,E127,E261,E261,E261,E303 \ No newline at end of file diff --git a/src/test/pythonFiles/linting/pycodestyleconfig/.pycodestyle b/src/test/pythonFiles/linting/pycodestyleconfig/.pycodestyle new file mode 100644 index 000000000000..b7c78f49db84 --- /dev/null +++ b/src/test/pythonFiles/linting/pycodestyleconfig/.pycodestyle @@ -0,0 +1,2 @@ +[pycodestyle] +ignore = E302,E901,E127,E261,E261,E261,E303 diff --git a/src/test/pythonFiles/linting/pep8config/file.py b/src/test/pythonFiles/linting/pycodestyleconfig/file.py similarity index 100% rename from src/test/pythonFiles/linting/pep8config/file.py rename to src/test/pythonFiles/linting/pycodestyleconfig/file.py diff --git a/src/testMultiRootWkspc/multi.code-workspace b/src/testMultiRootWkspc/multi.code-workspace index 65859ed0254a..9d64c3f8b53b 100644 --- a/src/testMultiRootWkspc/multi.code-workspace +++ b/src/testMultiRootWkspc/multi.code-workspace @@ -35,7 +35,7 @@ "python.linting.pydocstyleEnabled": false, "python.linting.pylamaEnabled": false, "python.linting.pylintEnabled": true, - "python.linting.pep8Enabled": false, + "python.linting.pycodestyleEnabled": false, "python.linting.prospectorEnabled": false, "python.workspaceSymbols.enabled": false, "python.formatting.provider": "yapf",