feat: add daysBetween helper#1
Conversation
There was a problem hiding this comment.
Automated Code Review
Score: 70 / 100
Project: code-review-demo
Reviewer: deepseek
Summary: The diff introduces a single utility function with multiple critical and warning issues: missing return types, use of any without a TODO annotation, and a magic number. The dominant issue category is type_safety.
Category Status
| Category | Status |
|---|---|
| structure | pass |
| type_safety | fail |
| code_style | warning |
| security | pass |
| error_handling | pass |
| configuration | pass |
| api_design | skipped |
| testing_patterns | skipped |
Issue Counts
Total: 3
Critical: 2
Warning: 1
Suggestion: 0
Individual issues are posted as inline comments on the affected lines. Open the Files changed tab to review them.
| @@ -0,0 +1,4 @@ | |||
| export function daysBetween(a: any, b: any) { | |||
There was a problem hiding this comment.
[critical] Function parameters a and b are typed as any without a TODO annotation.
Suggestion: Replace any with Date and add a TODO if temporary escape is needed, e.g., a: Date, b: Date.
| @@ -0,0 +1,4 @@ | |||
| export function daysBetween(a: any, b: any) { | |||
There was a problem hiding this comment.
[critical] Function daysBetween is exported but has no explicit return type.
Suggestion: Add explicit return type number to the function signature: export function daysBetween(a: Date, b: Date): number.
| @@ -0,0 +1,4 @@ | |||
| export function daysBetween(a: any, b: any) { | |||
| const msPerDay = 86400000; | |||
There was a problem hiding this comment.
[warning] The number 86400000 is a magic number used directly in the calculation.
Suggestion: Define a named constant like const MS_PER_DAY = 86400000; and use it instead.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Automated Code ReviewScore: 100 / 100
No issues found. Code follows all applicable guidelines. |
There was a problem hiding this comment.
Automated Code Review
Score: 100 / 100
Severities: blocker=0 major=0 minor=0 nit=0
Dominant category: none
| Category | Status |
|---|---|
| structure | pass |
| type_safety | pass |
| code_style | pass |
| security | pass |
| error_handling | pass |
| configuration | pass |
| api_design | pass |
| testing_patterns | pass |
No issues found. Code follows all applicable guidelines.
Automated Code ReviewScore: 🟢 100 / 100
No issues found. Code follows all applicable guidelines. |
There was a problem hiding this comment.
Automated Code Review
Score: 🟢 100 / 100
Severities: 🔴 blocker=0 🟠 major=0 🟡 minor=0 🔵 nit=0
Dominant category: none
| Category | Status |
|---|---|
| structure | 🟢 pass |
| type_safety | 🟢 pass |
| code_style | 🟢 pass |
| security | 🟢 pass |
| error_handling | 🟢 pass |
| configuration | 🟢 pass |
| api_design | 🟢 pass |
| testing_patterns | 🟢 pass |
No issues found. Code follows all applicable guidelines.
Automated Code ReviewScore: 🔴 50 / 100
The change is small but introduces critical type-safety violations in a shared utility function. Both issues are in the type_safety category and should be fixed before merge by adding explicit parameter and return types. |
There was a problem hiding this comment.
Automated Code Review
Score: 🔴 50 / 100
Severities: 🔴 blocker=2 🟠 major=0 🟡 minor=0 🔵 nit=0
Dominant category: type_safety
| Category | Status |
|---|---|
| structure | 🟢 pass |
| type_safety | 🔴 fail |
| code_style | 🟢 pass |
| security | 🟢 pass |
| error_handling | 🟢 pass |
| configuration | 🟢 pass |
| api_design | 🟢 pass |
| testing_patterns | ⚪ skipped |
The change is small but introduces critical type-safety violations in a shared utility function. Both issues are in the type_safety category and should be fixed before merge by adding explicit parameter and return types.
| @@ -0,0 +1,4 @@ | |||
| export function daysBetween(a: any, b: any) { | |||
There was a problem hiding this comment.
[blocker] The function signature uses any for both parameters (a: any, b: any) without a TODO escape-hatch note. This creates an unchecked type boundary in shared logic.
Suggestion: Replace any with concrete types, e.g. a: Date, b: Date, or use unknown plus runtime type guards if inputs are not guaranteed.
| @@ -0,0 +1,4 @@ | |||
| export function daysBetween(a: any, b: any) { | |||
There was a problem hiding this comment.
[blocker] The exported function daysBetween does not declare an explicit return type. Guidelines require explicit return types for function signatures.
Suggestion: Add an explicit return type: export function daysBetween(a: Date, b: Date): number { ... }.
Demo fixture for automated code review pipeline — 3 intentional violations (any params, magic number, missing return type).