8000 Do not hide unexpected errors from pyflakes (#371) · python-lsp/python-lsp-server@b00c528 · GitHub
[go: up one dir, main page]

Skip to content

Commit b00c528

Browse files
muffinmadgatesn
authored andcommitted
Do not hide unexpected errors from pyflakes (#371)
* Do not hide unexpected errors from pyflakes Pyflake's api can report source decoding error throught unexpectedError. If these errors are hidden then it's hard to say if linter is enabled and working. * Underscored unused variable
1 parent f3b71b3 commit b00c528

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

pyls/plugins/pyflakes_lint.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,17 @@ def __init__(self, lines):
3131
self.lines = lines
3232
self.diagnostics = []
3333

34-
def unexpectedError(self, filename, msg): # pragma: no cover
35-
pass
34+
def unexpectedError(self, _filename, msg): # pragma: no cover
35+
err_range = {
36+
'start': {'line': 0, 'character': 0},
37+
'end': {'line': 0, 'character': 0},
38+
}
39+
self.diagnostics.append({
40+
'source': 'pyflakes',
41+
'range': err_range,
42+
'message': msg,
43+
'severity': lsp.DiagnosticSeverity.Error,
44+
})
3645

3746
def syntaxError(self, _filename, msg, lineno, offset, text):
3847
# We've seen that lineno and offset can sometimes be None

0 commit comments

Comments
 (0)
0