diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index eff8a1f..0fb3d29 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] + python-version: ['3.8', '3.9', '3.10', '3.11'] steps: - uses: actions/checkout@v3 diff --git a/anakinls/server.py b/anakinls/server.py index b14ad32..0f6419b 100644 --- a/anakinls/server.py +++ b/anakinls/server.py @@ -31,7 +31,7 @@ from jedi.api.refactoring import Refactoring # type: ignore from lsprotocol import types from pycodestyle import BaseReport as CodestyleBaseReport # type: ignore -from pycodestyle import Checker as CodestyleChecker +from pycodestyle import Checker as CodestyleBaseChecker from pycodestyle import StyleGuide as CodestyleStyleGuide from pyflakes.api import check as pyflakes_check # type: ignore from pygls.protocol import LanguageServerProtocol, lsp_method @@ -223,6 +223,12 @@ def flake(self, message): ) +class CodestyleChecker(CodestyleBaseChecker): + def report_invalid_syntax(self): + # Syntax errors are provided by Jedi. Just ignore pycodestyle. + pass + + class CodestyleReport(CodestyleBaseReport): def __init__(self, options, result): super().__init__(options) diff --git a/tests/test_server.py b/tests/test_server.py index 6cf3b31..38c3203 100644 --- a/tests/test_server.py +++ b/tests/test_server.py @@ -32,6 +32,7 @@ def __init__(self): @pytest.fixture() def server(): + aserver.scripts.clear() return Server() @@ -139,9 +140,9 @@ def test_diff_to_edits(): assert str(edits[3].range) == '24:0-24:0' -def test_no_pyflakes_syntax_error_diagnostic(server): +@pytest.mark.parametrize('content', ('pass\n\nif\n', 'def foo(def\n')) +def test_only_jedi_syntax_error_diagnostic(server, content): uri = 'file://test_diagnostic.py' - content = 'pass\n\nif\n' doc = Document(uri, content) server.workspace.get_text_document = Mock(return_value=doc) server.publish_diagnostics = Mock()