Severity: LOW
File: mcpgateway/services/log_aggregator.py
Line: 873
Rule: python:S3923
Description
The conditional expression always evaluates to the same result regardless of the condition:
resolved_end = reference if window_end is None else reference
Both branches return reference, making the conditional useless.
Code Context
# Lines 863-883
if window_end is None:
reference = datetime.now(timezone.utc)
else:
reference = window_end.astimezone(timezone.utc)
reference = reference.replace(second=0, microsecond=0)
minutes_offset = reference.minute % self.aggregation_window_minutes
if window_end is None and minutes_offset:
reference = reference - timedelta(minutes=minutes_offset)
resolved_end = reference if window_end is None else reference # Redundant
Impact
None - code functions correctly. This is a maintainability/readability issue.
Suggested Fix
Replace the redundant ternary with a simple assignment:
Severity: LOW
File:
mcpgateway/services/log_aggregator.pyLine: 873
Rule: python:S3923
Description
The conditional expression always evaluates to the same result regardless of the condition:
Both branches return
reference, making the conditional useless.Code Context
Impact
None - code functions correctly. This is a maintainability/readability issue.
Suggested Fix
Replace the redundant ternary with a simple assignment: