forked from microsoft/vscode-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpycodestyle.ts
More file actions
29 lines (26 loc) · 1.06 KB
/
pycodestyle.ts
File metadata and controls
29 lines (26 loc) · 1.06 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
import { CancellationToken, OutputChannel, TextDocument } from 'vscode';
import '../common/extensions';
import { Product } from '../common/types';
import { IServiceContainer } from '../ioc/types';
import { BaseLinter } from './baseLinter';
import { ILintMessage } from './types';
const COLUMN_OFF_SET = 1;
export class Pycodestyle extends BaseLinter {
constructor(outputChannel: OutputChannel, serviceContainer: IServiceContainer) {
super(Product.pycodestyle, outputChannel, serviceContainer, COLUMN_OFF_SET);
}
protected async runLinter(document: TextDocument, cancellation: CancellationToken): Promise<ILintMessage[]> {
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.pycodestyleCategorySeverity,
);
});
return messages;
}
}