Skip to content

Commit

Permalink
Report Flake8 errors with Error severity level (#234)
Browse files Browse the repository at this point in the history
  • Loading branch information
lcheylus authored Jun 30, 2022
1 parent c78a4c5 commit 5b29eac
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pylsp/plugins/flake8_lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def parse_stdout(document, stdout):
# show also the code in message
msg = code + ' ' + msg
severity = lsp.DiagnosticSeverity.Warning
if code[0] == "E":
if code == "E999" or code[0] == "F":
severity = lsp.DiagnosticSeverity.Error
diagnostics.append(
{
Expand Down
4 changes: 2 additions & 2 deletions test/plugins/test_flake8_lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def test_flake8_unsaved(workspace):
assert unused_var['code'] == 'F841'
assert unused_var['range']['start'] == {'line': 5, 'character': 1}
assert unused_var['range']['end'] == {'line': 5, 'character': 11}
assert unused_var['severity'] == lsp.DiagnosticSeverity.Warning
assert unused_var['severity'] == lsp.DiagnosticSeverity.Error


def test_flake8_lint(workspace):
Expand All @@ -53,7 +53,7 @@ def test_flake8_lint(workspace):
assert unused_var['code'] == 'F841'
assert unused_var['range']['start'] == {'line': 5, 'character': 1}
assert unused_var['range']['end'] == {'line': 5, 'character': 11}
assert unused_var['severity'] == lsp.DiagnosticSeverity.Warning
assert unused_var['severity'] == lsp.DiagnosticSeverity.Error
finally:
os.remove(name)

Expand Down

0 comments on commit 5b29eac

Please sign in to comment.