-
Notifications
You must be signed in to change notification settings - Fork 613
[CLEANUP][SONAR][LOW]: Dead code - unused function json_default in llmchat_router.py #2372
Copy link
Copy link
Closed
Copy link
Labels
COULDP3: Nice-to-have features with minimal impact if left out; included if time permitsP3: Nice-to-have features with minimal impact if left out; included if time permitschoreLinting, formatting, dependency hygiene, or project maintenance choresLinting, formatting, dependency hygiene, or project maintenance choresgood first issueGood for newcomersGood for newcomerspythonPython / backend development (FastAPI)Python / backend development (FastAPI)sonarSonarQube code quality findingsSonarQube code quality findings
Milestone
Description
Severity: LOW
File: mcpgateway/routers/llmchat_router.py
Line: 805
Rule: python:S1144
Description
The nested function json_default is defined but never called anywhere in the code. It only appears in docstring examples.
Code
def json_default(obj):
"""
Default JSON serializer helper for non-serializable Python objects.
...
Examples:
>>> json_default(Simple()) # Only in docstrings
"""
if hasattr(obj, "model_dump"):
return obj.model_dump()
# ... etcImpact
None - dead code that adds maintenance burden without providing value.
Suggested Fix
Either:
- Remove the unused function entirely
- Use it where JSON serialization is needed in the module
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
COULDP3: Nice-to-have features with minimal impact if left out; included if time permitsP3: Nice-to-have features with minimal impact if left out; included if time permitschoreLinting, formatting, dependency hygiene, or project maintenance choresLinting, formatting, dependency hygiene, or project maintenance choresgood first issueGood for newcomersGood for newcomerspythonPython / backend development (FastAPI)Python / backend development (FastAPI)sonarSonarQube code quality findingsSonarQube code quality findings