Skip to content

Test: Medium/Low severity findings only#10

Open
matej wants to merge 1 commit intomainfrom
matej/test-medium-low-findings
Open

Test: Medium/Low severity findings only#10
matej wants to merge 1 commit intomainfrom
matej/test-medium-low-findings

Conversation

@matej
Copy link
Member

@matej matej commented Feb 4, 2026

Summary

Test PR to verify that inline comments are posted even when the review is APPROVED (no HIGH severity findings).

This file contains intentional issues:

  • O(n²) algorithm (MEDIUM - performance)
  • Magic numbers (LOW - maintainability)
  • Missing empty input handling (LOW - correctness)
  • Unused variable (LOW - maintainability)

Expected behavior

  • Individual inline comments for each finding
  • Final review: APPROVE (not REQUEST_CHANGES)

🤖 Generated with Claude Code

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary: 2 findings across 1 file (HIGH: 0, MEDIUM: 2, LOW: 0).
Assessment: Changes look acceptable overall; consider addressing the findings.

Comment on lines +27 to +34
def process_data(data):
"""Process data and return result.

Low severity: Doesn't handle empty input gracefully.
"""
total = 0
for item in data:
total += item["value"] # Will crash if data is empty or item has no "value"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Code Review Finding: Division by zero when processing empty data

Severity: MEDIUM
Category: correctness

Impact: Any call to process_data([]) will crash the application with a ZeroDivisionError. This is a runtime bug that will cause unexpected failures.

Recommendation: Add a guard clause to handle empty input gracefully, either by returning a default value or raising a meaningful exception.

Suggested change
def process_data(data):
"""Process data and return result.
Low severity: Doesn't handle empty input gracefully.
"""
total = 0
for item in data:
total += item["value"] # Will crash if data is empty or item has no "value"
def process_data(data):
"""Process data and return result.
Low severity: Doesn't handle empty input gracefully.
"""
if not data:
return 0
total = 0
for item in data:
total += item["value"] # Will crash if data is empty or item has no "value"
return total / len(data)

Comment on lines +4 to +14
def find_duplicates(items):
"""Find duplicate items in a list.

Medium severity: O(n²) algorithm when O(n) with set is possible.
"""
duplicates = []
for i in range(len(items)):
for j in range(i + 1, len(items)):
if items[i] == items[j] and items[i] not in duplicates:
duplicates.append(items[i])
return duplicates
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Code Review Finding: Quadratic time complexity in duplicate detection

Severity: MEDIUM
Category: performance

Impact: For large input lists, this function will become extremely slow. A list of 10,000 items could require up to 100 million comparisons, causing performance degradation in production.

Recommendation: Use a set-based approach to achieve O(n) time complexity.

Suggested change
def find_duplicates(items):
"""Find duplicate items in a list.
Medium severity: O(n²) algorithm when O(n) with set is possible.
"""
duplicates = []
for i in range(len(items)):
for j in range(i + 1, len(items)):
if items[i] == items[j] and items[i] not in duplicates:
duplicates.append(items[i])
return duplicates
def find_duplicates(items):
"""Find duplicate items in a list.
Medium severity: O(n²) algorithm when O(n) with set is possible.
"""
seen = set()
duplicates = set()
for item in items:
if item in seen:
duplicates.add(item)
else:
seen.add(item)
return list(duplicates)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant