From 166b5f6133e82b294ebfa79c175013e1caea6651 Mon Sep 17 00:00:00 2001 From: Jan Breig Date: Tue, 25 Apr 2023 10:32:17 +0200 Subject: [PATCH 1/2] Fix empty cwd value for pylint Fixes https://github.com/python-lsp/python-lsp-server/issues/369 --- pylsp/plugins/pylint_lint.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pylsp/plugins/pylint_lint.py b/pylsp/plugins/pylint_lint.py index 76e990c5..7daaf18a 100644 --- a/pylsp/plugins/pylint_lint.py +++ b/pylsp/plugins/pylint_lint.py @@ -95,8 +95,13 @@ def lint(cls, document, is_saved, flags=''): ] + (shlex.split(str(flags)) if flags else []) log.debug("Calling pylint with '%s'", ' '.join(cmd)) + cwd = document._workspace.root_path + + if not cwd: + cwd = os.path.dirname(__file__) + with Popen(cmd, stdout=PIPE, stderr=PIPE, - cwd=document._workspace.root_path, universal_newlines=True) as process: + cwd=cwd, universal_newlines=True) as process: process.wait() json_out = process.stdout.read() err = process.stderr.read() From df13cf359a0a94c66673ef83c505312215e610bc Mon Sep 17 00:00:00 2001 From: Carlos Cordoba Date: Mon, 15 May 2023 06:06:17 -0500 Subject: [PATCH 2/2] Fix linting issues --- pylsp/plugins/pylint_lint.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pylsp/plugins/pylint_lint.py b/pylsp/plugins/pylint_lint.py index 7daaf18a..b4a43972 100644 --- a/pylsp/plugins/pylint_lint.py +++ b/pylsp/plugins/pylint_lint.py @@ -48,7 +48,7 @@ class PylintLinter: last_diags = collections.defaultdict(list) @classmethod - def lint(cls, document, is_saved, flags=''): + def lint(cls, document, is_saved, flags=''): # pylint: disable=too-many-locals,too-many-branches """Plugin interface to pylsp linter. Args: @@ -96,7 +96,6 @@ def lint(cls, document, is_saved, flags=''): log.debug("Calling pylint with '%s'", ' '.join(cmd)) cwd = document._workspace.root_path - if not cwd: cwd = os.path.dirname(__file__)