Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 0 additions & 1 deletion bundled/tool/lsp_jsonrpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# Licensed under the MIT License.
"""Light-weight JSON-RPC over standard IO."""


import atexit
import contextlib
import io
Expand Down Expand Up @@ -82,7 +81,7 @@
line = to_str(self._readline()).strip()

content = to_str(self._reader.read(length))
return json.loads(content)

Check warning on line 84 in bundled/tool/lsp_jsonrpc.py

View check run for this annotation

Precaution / Precaution Unsubscribed

PY009: Deserialization of Untrusted Data

Potential unsafe usage of 'json.loads' that can allow instantiation of arbitrary objects.

def _readline(self):
line = self._reader.readline()
Expand Down
1 change: 1 addition & 0 deletions bundled/tool/lsp_server.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
"""Implementation of tool support over LSP."""

from __future__ import annotations

import copy
Expand Down Expand Up @@ -117,7 +118,7 @@

# pylint: disable=too-many-locals
def _parse_output(content: str) -> list[lsp.Diagnostic]:
run = json.loads(content)["runs"][0] or {}

Check warning on line 121 in bundled/tool/lsp_server.py

View check run for this annotation

Precaution / Precaution Unsubscribed

PY009: Deserialization of Untrusted Data

Potential unsafe usage of 'json.loads' that can allow instantiation of arbitrary objects.
results = run.get("results") or []
diagnostics: list[lsp.Diagnostic] = []

Expand Down
1 change: 1 addition & 0 deletions bundled/tool/lsp_utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
"""Utility functions and classes for use with running tools over LSP."""

from __future__ import annotations

import contextlib
Expand Down
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,9 @@ mdurl==0.1.2 \
--hash=sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8 \
--hash=sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba
# via markdown-it-py
packaging==25.0 \
--hash=sha256:29572ef2b1f17581046b3a2227d5c611fb25ec70ca1ba8554b24b0e69331a484 \
--hash=sha256:d443872c98d677bf60f6a1f2f8c1cb748e8fe762d2bf9d3148b5599295b0fc4f
packaging==26.0 \
--hash=sha256:00243ae351a257117b6a241061796684b084ed1c516a08c48a3f7e147a9d80b4 \
--hash=sha256:b36f1fef9334a5588b4166f8bcd26a14e521f2b55e6b9de3aaa80d3ff7a37529
# via -r requirements.in
pbr==6.1.1 \
--hash=sha256:38d4daea5d9fa63b3f626131b9d34947fd0c8be9b05a29276870580050a25a76 \
Expand Down
1 change: 1 addition & 0 deletions src/test/python_tests/lsp_test_client/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""
Constants for use with tests.
"""

import pathlib

TEST_ROOT = pathlib.Path(__file__).parent.parent
Expand Down
1 change: 1 addition & 0 deletions src/test/python_tests/lsp_test_client/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""
Utility functions for use with tests.
"""

import json
import os
import pathlib
Expand Down Expand Up @@ -48,14 +49,14 @@
def get_server_info_defaults():
"""Returns server info from package.json"""
package_json_path = PROJECT_ROOT / "package.json"
package_json = json.loads(package_json_path.read_text())

Check warning on line 52 in src/test/python_tests/lsp_test_client/utils.py

View check run for this annotation

Precaution / Precaution Unsubscribed

PY009: Deserialization of Untrusted Data

Potential unsafe usage of 'json.loads' that can allow instantiation of arbitrary objects.
return package_json["serverInfo"]


def get_initialization_options():
"""Returns initialization options from package.json"""
package_json_path = PROJECT_ROOT / "package.json"
package_json = json.loads(package_json_path.read_text())

Check warning on line 59 in src/test/python_tests/lsp_test_client/utils.py

View check run for this annotation

Precaution / Precaution Unsubscribed

PY009: Deserialization of Untrusted Data

Potential unsafe usage of 'json.loads' that can allow instantiation of arbitrary objects.

server_info = package_json["serverInfo"]
server_id = server_info["module"]
Expand Down
1 change: 1 addition & 0 deletions src/test/python_tests/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""
Test for linting over LSP.
"""

from threading import Event

from hamcrest import assert_that, is_
Expand Down