Skip to content

Commit 784c6a9

Browse files
authored
Fix empty cwd value for pylint (#371)
1 parent c81dcc8 commit 784c6a9

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pylsp/plugins/pylint_lint.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class PylintLinter:
4848
last_diags = collections.defaultdict(list)
4949

5050
@classmethod
51-
def lint(cls, document, is_saved, flags=''):
51+
def lint(cls, document, is_saved, flags=''): # pylint: disable=too-many-locals,too-many-branches
5252
"""Plugin interface to pylsp linter.
5353
5454
Args:
@@ -95,8 +95,12 @@ def lint(cls, document, is_saved, flags=''):
9595
] + (shlex.split(str(flags)) if flags else [])
9696
log.debug("Calling pylint with '%s'", ' '.join(cmd))
9797

98+
cwd = document._workspace.root_path
99+
if not cwd:
100+
cwd = os.path.dirname(__file__)
101+
98102
with Popen(cmd, stdout=PIPE, stderr=PIPE,
99-
cwd=document._workspace.root_path, universal_newlines=True) as process:
103+
cwd=cwd, universal_newlines=True) as process:
100104
process.wait()
101105
json_out = process.stdout.read()
102106
err = process.stderr.read()

0 commit comments

Comments
 (0)