From 5b29eac4fd65aa87b7158917e19c777bce9a3fc5 Mon Sep 17 00:00:00 2001 From: Laurent Cheylus Date: Thu, 30 Jun 2022 17:48:51 +0200 Subject: [PATCH] Report Flake8 errors with Error severity level (#234) --- pylsp/plugins/flake8_lint.py | 2 +- test/plugins/test_flake8_lint.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pylsp/plugins/flake8_lint.py b/pylsp/plugins/flake8_lint.py index 6be83b99..66aaaf36 100644 --- a/pylsp/plugins/flake8_lint.py +++ b/pylsp/plugins/flake8_lint.py @@ -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( { diff --git a/test/plugins/test_flake8_lint.py b/test/plugins/test_flake8_lint.py index a72383ec..e9e7d216 100644 --- a/test/plugins/test_flake8_lint.py +++ b/test/plugins/test_flake8_lint.py @@ -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): @@ -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)