Skip to content

Commit 4f19099

Browse files
RomanKornevd3r3kk
authored andcommitted
Use Pylint message names instead of codes (microsoft#3600)
For microsoft#2906
1 parent 7d419ed commit 4f19099

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

news/1 Enhancements/2906.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Use Pylint message names instead of codes
2+
(thanks to [Roman Kornev](https://github.com/RomanKornev/))

src/client/linters/pylint.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ import { ILintMessage } from './types';
1515
const pylintrc = 'pylintrc';
1616
const dotPylintrc = '.pylintrc';
1717

18+
const REGEX = '(?<line>\\d+),(?<column>-?\\d+),(?<type>\\w+),(?<code>[\\w-]+):(?<message>.*)\\r?(\\n|$)';
19+
1820
export class Pylint extends BaseLinter {
1921
private fileSystem: IFileSystem;
2022
private platformService: IPlatformService;
@@ -67,12 +69,12 @@ export class Pylint extends BaseLinter {
6769
];
6870
}
6971
const args = [
70-
'--msg-template=\'{line},{column},{category},{msg_id}:{msg}\'',
72+
'--msg-template=\'{line},{column},{category},{symbol}:{msg}\'',
7173
'--reports=n',
7274
'--output-format=text',
7375
uri.fsPath
7476
];
75-
const messages = await this.run(minArgs.concat(args), document, cancellation);
77+
const messages = await this.run(minArgs.concat(args), document, cancellation, REGEX);
7678
messages.forEach(msg => {
7779
msg.severity = this.parseMessagesSeverity(msg.type, this.pythonSettings.linting.pylintCategorySeverity);
7880
});

0 commit comments

Comments
 (0)