MCPcopy Create free account
hub / github.com/MiroMindAI/MiroThinker / check_unused_code

Function check_unused_code

apps/lobehub-compatibility/test_tool_parser.py:291–334  ·  view source on GitHub ↗

Check for unused code in the parser.

()

Source from the content-addressed store, hash-verified

289
290
291def check_unused_code():
292 """Check for unused code in the parser."""
293 print("\n" + "=" * 60)
294 print("CODE ANALYSIS - Potential Issues")
295 print("=" * 60)
296
297 issues = []
298
299 # Issue 1: Unused variables
300 unused_vars = [
301 "self.current_tool_name_sent",
302 "self.prev_tool_call_arr",
303 "self.current_tool_id",
304 "self.streamed_args_for_tool",
305 "self.buffer",
306 ]
307 issues.append(
308 f"⚠️ Unused instance variables (defined but never used in main logic):\n {', '.join(unused_vars)}"
309 )
310
311 # Issue 2: Unused method
312 issues.append("⚠️ `_ensure_tool_id_valid` method is defined but never called")
313
314 # Issue 3: Unused regex
315 issues.append("⚠️ `partial_tool_regex` is defined but never used")
316
317 # Issue 4: server_name handling
318 issues.append(
319 "⚠️ `_resolve_tool_name` checks for 'default' server_name,\n but chat_template.jinja uses 'my_mcp_server'"
320 )
321
322 for issue in issues:
323 print(f"\n{issue}")
324
325 print("\n" + "=" * 60)
326 print("RECOMMENDATIONS")
327 print("=" * 60)
328 print("""
3291. Remove unused variables and methods to clean up the code
3302. Either use `partial_tool_regex` or remove it
3313. Update `_resolve_tool_name` to handle 'my_mcp_server' correctly
3324. The streaming implementation looks correct with the state machine approach
3335. The main `extract_tool_calls` and `extract_tool_calls_streaming` logic appears sound
334""")
335
336
337def main():

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected