Skip to content

Commit 93ed04d

Browse files
committed
reduced complexity and error on old namespace
1 parent adf1572 commit 93ed04d

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

pylsp_mypy/plugin.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -145,14 +145,11 @@ def pylsp_lint(
145145
"""
146146
settings = config.plugin_settings("pylsp_mypy")
147147
oldSettings1 = config.plugin_settings("mypy-ls")
148-
if oldSettings1 != {}:
149-
raise DeprecationWarning(
150-
"Your configuration uses the namespace mypy-ls, this should be changed to pylsp_mypy"
151-
)
152148
oldSettings2 = config.plugin_settings("mypy_ls")
153-
if oldSettings2 != {}:
154-
raise DeprecationWarning(
155-
"Your configuration uses the namespace mypy_ls, this should be changed to pylsp_mypy"
149+
if oldSettings1 != {} or oldSettings2 != {}:
150+
raise NameError(
151+
"Your configuration uses an old namespace (mypy-ls or mypy_ls)."
152+
+ "This should be changed to pylsp_mypy"
156153
)
157154
if settings == {}:
158155
settings = oldSettings1
@@ -402,7 +399,7 @@ def findConfigFile(path: str, names: List[str]) -> Optional[str]:
402399
file = parent.joinpath(name)
403400
if file.is_file():
404401
if file.name in ["mypy-ls.cfg", "mypy_ls.cfg"]:
405-
raise DeprecationWarning(
402+
raise NameError(
406403
f"{str(file)}: {file.name} is no longer supported, you should rename your "
407404
"config file to pylsp-mypy.cfg or preferably use a pyproject.toml instead."
408405
)

test/test_plugin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ def test_dmypy_status_file(tmpdir, last_diagnostics_monkeypatch, workspace):
245245

246246
assert not statusFile.exists()
247247

248-
diags = plugin.pylsp_lint(
248+
plugin.pylsp_lint(
249249
config=FakeConfig(),
250250
workspace=workspace,
251251
document=document,

0 commit comments

Comments
 (0)