forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.ts
More file actions
43 lines (41 loc) · 1.68 KB
/
Copy pathmain.ts
File metadata and controls
43 lines (41 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import { OutputChannel } from 'vscode';
import { workspace } from 'vscode';
import { Product } from '../common/installer';
import { BaseLinter } from './baseLinter';
import * as prospector from './../linters/prospector';
import * as pylint from './../linters/pylint';
import * as pep8 from './../linters/pep8Linter';
import * as pylama from './../linters/pylama';
import * as flake8 from './../linters/flake8';
import * as pydocstyle from './../linters/pydocstyle';
import * as mypy from './../linters/mypy';
export class LinterFactor {
public static createLinter(product: Product, outputChannel: OutputChannel, workspaceRootPath: string = workspace.rootPath): BaseLinter {
switch (product) {
case Product.flake8: {
return new flake8.Linter(outputChannel, workspaceRootPath);
}
case Product.mypy: {
return new mypy.Linter(outputChannel, workspaceRootPath);
}
case Product.pep8: {
return new pep8.Linter(outputChannel, workspaceRootPath);
}
case Product.prospector: {
return new prospector.Linter(outputChannel, workspaceRootPath);
}
case Product.pydocstyle: {
return new pydocstyle.Linter(outputChannel, workspaceRootPath);
}
case Product.pylama: {
return new pylama.Linter(outputChannel, workspaceRootPath);
}
case Product.pylint: {
return new pylint.Linter(outputChannel, workspaceRootPath);
}
default: {
throw new Error(`Invalid Linter '${Product[product]}''`);
}
}
}
}