-
Notifications
You must be signed in to change notification settings - Fork 614
[CLEANUP][SONAR][LOW]: Dead code - unused variable max_duration in admin.py #2371
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/admin.py
Line: 17002
Rule: python:S1854
Description
The variable max_duration is reassigned but never used after the assignment.
Code
# Lines 16995-17006
min_duration = float(stats_row.min_d)
max_duration = float(stats_row.max_d)
latency_range = max_duration - min_duration
# Handle case where all durations are the same
if latency_range == 0:
latency_range = 1.0
max_duration = min_duration + 1.0 # <-- Never used after this
time_range_minutes = hours * 60
latency_bucket_size = latency_range / latency_buckets # Uses latency_range, not max_durationImpact
None - code functions correctly. The latency_range is already calculated before the reassignment, so the new max_duration value has no effect.
Suggested Fix
Remove the unused assignment:
if latency_range == 0:
latency_range = 1.0
# Remove: max_duration = min_duration + 1.0Reactions 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