Skip to content

Commit bfcd225

Browse files
AllanDaemonDonJayamanne
authored andcommitted
Fix MyPy linter message REGEX to handle any python extension (#2402)
Fixes #2380 The regex expression to match MyPy linter messages expects that the file name has a `.py` extension, that isn't always the case. E.g., `.pyi` files for describing interfaces. - [X] Title summarizes what is changing - [X] Includes a [news entry](https://github.com/Microsoft/vscode-python/tree/master/news) file (remember to thank yourself!) - [X] Unit tests & [code coverage](https://codecov.io/gh/Microsoft/vscode-python) are not adversely affected (within reason) - [X] Works on all [actively maintained versions of Python](https://devguide.python.org/#status-of-python-branches) (e.g. Python 2.7 & the latest Python 3 release) - [X] Works on Windows 10, macOS, and Linux (e.g. considered file system case-sensitivity) - [X] Dependencies are pinned (e.g. `"1.2.3"`, not `"^1.2.3"`) - [X] `package-lock.json` has been regenerated if dependencies have changed
1 parent a5997f7 commit bfcd225

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

news/2 Fixes/2380.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix the regex expression to match MyPy linter messages that expects the file name to have a .py extension, that isn't always the case, to catch any filename.
2+
E.g., .pyi files that describes interfaces wouldn't get the linter messages to Problems tab.

src/client/linters/mypy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { IServiceContainer } from '../ioc/types';
55
import { BaseLinter } from './baseLinter';
66
import { ILintMessage } from './types';
77

8-
const REGEX = '(?<file>.py):(?<line>\\d+): (?<type>\\w+): (?<message>.*)\\r?(\\n|$)';
8+
const REGEX = '(?<file>.+):(?<line>\\d+): (?<type>\\w+): (?<message>.*)\\r?(\\n|$)';
99

1010
export class MyPy extends BaseLinter {
1111
constructor(outputChannel: OutputChannel, serviceContainer: IServiceContainer) {

0 commit comments

Comments
 (0)