mirror of
https://github.com/tiennm99/serena.git
synced 2026-10-14 18:19:14 +00:00
Fix: jet_brains_run_inspections returned incorrectly transformed data
The tool incorrectly applied the pythonification, even though it returns data not only in values but also in keys
This commit is contained in:
1 parent
9825316c23
commit
a3de03b556
2 files changed
+16
-3
No files matched your search
@@ -107,6 +107,7 @@ Status of the `main` branch. Changes prior to the next official version change w
|
||||
- Add configuration option `jetbrains_launch_command`, allowing Serena to spawn IDE instances automatically
|
||||
upon project activation
|
||||
- Fix: `jet_brains_list_inspections` failed when only default parameters were used #1615
|
||||
- Fix: `jet_brains_run_inspections` returned incorrectly transformed data (malforming snake-case conversion applied to all keys)
|
||||
|
||||
* Dashboard:
|
||||
- Make list of trusted hosts configurable, fixing host validation introduced in v1.5.2 allowing only
|
||||
|
||||
@@ -303,7 +303,15 @@ class JetBrainsPluginClient(ToStringMixin):
|
||||
f"{self._plugin_version}. Ask the user to update the plugin!"
|
||||
)
|
||||
|
||||
def _make_request(self, method: str, endpoint: str, data: Optional[dict] = None) -> dict[str, Any]:
|
||||
def _make_request(self, method: str, endpoint: str, data: Optional[dict] = None, pythonify: bool = True) -> dict[str, Any]:
|
||||
"""
|
||||
:param method: the HTTP method to use ("GET" or "POST")
|
||||
:param endpoint: the endpoint to call (e.g., "/findSymbol")
|
||||
:param data: the data to send in the request body (for POST requests)
|
||||
:param pythonify: whether to recursively "pythonify" the response object, converting all keys to snake_case.
|
||||
This must not be enabled if *any* key contains variable data rather (and therefore isn't a well-defined DTO structure).
|
||||
:return: the response as a dictionary
|
||||
"""
|
||||
url = f"{self._base_url}{endpoint}"
|
||||
|
||||
response: Response | None = None
|
||||
@@ -320,7 +328,11 @@ class JetBrainsPluginClient(ToStringMixin):
|
||||
|
||||
# Try to parse JSON response
|
||||
try:
|
||||
return self._pythonify_response(response.json())
|
||||
response_json = response.json()
|
||||
if pythonify:
|
||||
return self._pythonify_response(response_json)
|
||||
else:
|
||||
return response_json
|
||||
except json.JSONDecodeError:
|
||||
# If response is not JSON, return raw text
|
||||
return {"response": response.text}
|
||||
@@ -695,7 +707,7 @@ class JetBrainsPluginClient(ToStringMixin):
|
||||
request_data["startLine"] = start_line
|
||||
if end_line is not None:
|
||||
request_data["endLine"] = end_line
|
||||
return cast(jb.RunInspectionsResponse, self._make_request("POST", "/runInspectionsOnFile", request_data))
|
||||
return cast(jb.RunInspectionsResponse, self._make_request("POST", "/runInspectionsOnFile", request_data, pythonify=False))
|
||||
|
||||
def list_inspections(
|
||||
self,
|
||||
|
||||
Reference in new issue
Block a user