Skip to content

Commit e1edd2a

Browse files
authored
Ignore syntax errors from pycodestyle (#23)
* Ignore syntax errors from pycodestyle * Drop testing against python 3.7
1 parent e6dd190 commit e1edd2a

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

.github/workflows/python-package.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ubuntu-latest
1616
strategy:
1717
matrix:
18-
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
18+
python-version: ['3.8', '3.9', '3.10', '3.11']
1919

2020
steps:
2121
- uses: actions/checkout@v3

anakinls/server.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
from jedi.api.refactoring import Refactoring # type: ignore
3232
from lsprotocol import types
3333
from pycodestyle import BaseReport as CodestyleBaseReport # type: ignore
34-
from pycodestyle import Checker as CodestyleChecker
34+
from pycodestyle import Checker as CodestyleBaseChecker
3535
from pycodestyle import StyleGuide as CodestyleStyleGuide
3636
from pyflakes.api import check as pyflakes_check # type: ignore
3737
from pygls.protocol import LanguageServerProtocol, lsp_method
@@ -223,6 +223,12 @@ def flake(self, message):
223223
)
224224

225225

226+
class CodestyleChecker(CodestyleBaseChecker):
227+
def report_invalid_syntax(self):
228+
# Syntax errors are provided by Jedi. Just ignore pycodestyle.
229+
pass
230+
231+
226232
class CodestyleReport(CodestyleBaseReport):
227233
def __init__(self, options, result):
228234
super().__init__(options)

tests/test_server.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ def __init__(self):
3232

3333
@pytest.fixture()
3434
def server():
35+
aserver.scripts.clear()
3536
return Server()
3637

3738

@@ -139,9 +140,9 @@ def test_diff_to_edits():
139140
assert str(edits[3].range) == '24:0-24:0'
140141

141142

142-
def test_no_pyflakes_syntax_error_diagnostic(server):
143+
@pytest.mark.parametrize('content', ('pass\n\nif\n', 'def foo(def\n'))
144+
def test_only_jedi_syntax_error_diagnostic(server, content):
143145
uri = 'file://test_diagnostic.py'
144-
content = 'pass\n\nif\n'
145146
doc = Document(uri, content)
146147
server.workspace.get_text_document = Mock(return_value=doc)
147148
server.publish_diagnostics = Mock()

0 commit comments

Comments
 (0)