Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: add None for empty return statements in server.py #386

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions ruff_lsp/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ async def did_open(params: DidOpenTextDocumentParams) -> None:
)
settings = _get_settings_by_document(document.path)
if not lint_enable(settings):
return
return None

diagnostics = await _lint_document_impl(document, settings)
LSP_SERVER.publish_diagnostics(document.uri, diagnostics)
Expand All @@ -469,7 +469,7 @@ async def did_save(params: DidSaveTextDocumentParams) -> None:
text_document = LSP_SERVER.workspace.get_text_document(params.text_document.uri)
settings = _get_settings_by_document(text_document.path)
if not lint_enable(settings):
return
return None

if lint_run(settings) in (
Run.OnType,
Expand All @@ -486,7 +486,7 @@ async def did_change(params: DidChangeTextDocumentParams) -> None:
text_document = LSP_SERVER.workspace.get_text_document(params.text_document.uri)
settings = _get_settings_by_document(text_document.path)
if not lint_enable(settings):
return
return None

if lint_run(settings) == Run.OnType:
document = Document.from_text_document(text_document)
Expand All @@ -502,12 +502,12 @@ async def did_open_notebook(params: DidOpenNotebookDocumentParams) -> None:
)
if notebook_document is None:
log_warning(f"No notebook document found for {params.notebook_document.uri!r}")
return
return None

document = Document.from_notebook_document(notebook_document)
settings = _get_settings_by_document(document.path)
if not lint_enable(settings):
return
return None

diagnostics = await _lint_document_impl(document, settings)

Expand Down Expand Up @@ -571,12 +571,12 @@ async def _did_change_or_save_notebook(
)
if notebook_document is None:
log_warning(f"No notebook document found for {notebook_uri!r}")
return
return None

document = Document.from_notebook_document(notebook_document)
settings = _get_settings_by_document(document.path)
if not lint_enable(settings):
return
return None

if lint_run(settings) in run_types:
cell_diagnostics = _group_diagnostics_by_cell(
Expand Down Expand Up @@ -1173,11 +1173,11 @@ async def apply_autofix(arguments: tuple[TextDocument]):
document = Document.from_uri(uri)
settings = _get_settings_by_document(document.path)
if not lint_enable(settings):
return
return None

workspace_edit = await _fix_document_impl(document, settings)
if workspace_edit is None:
return
return None
LSP_SERVER.apply_edit(workspace_edit, "Ruff: Fix all auto-fixable problems")


Expand All @@ -1188,7 +1188,7 @@ async def apply_organize_imports(arguments: tuple[TextDocument]):
settings = _get_settings_by_document(document.path)
workspace_edit = await _fix_document_impl(document, settings, only=["I001", "I002"])
if workspace_edit is None:
return
return None
LSP_SERVER.apply_edit(workspace_edit, "Ruff: Format imports")


Expand Down Expand Up @@ -1660,7 +1660,7 @@ def _update_workspace_settings(settings: list[WorkspaceSettings]) -> None:
"workspacePath": workspace_path,
"workspace": uris.from_fs_path(workspace_path),
}
return
return None

for setting in settings:
if "workspace" in setting:
Expand Down
Loading