-
Notifications
You must be signed in to change notification settings - Fork 18
fix #72 : Replace hardcoded display limits with named constants in ShowFileStatistics #76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
… in ShowFileStatistics - Add MaxStagedFiles, MaxUnstagedFiles, and MaxUntrackedFiles constants - Update all references to use these constants instead of hardcoded values (5, 3, 3)
fix DFanso#72 : Replace hardcoded display limits with named constants in ShowFileStatistics
WalkthroughIntroduced three exported constants (MaxStagedFiles, MaxUnstagedFiles, MaxUntrackedFiles) in internal/display/display.go and replaced hard-coded numeric thresholds in ShowFileStatistics with these constants. Logic and control flow remain unchanged; only the limits for displayed file counts and “... and N more” computations now reference the constants. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant U as User
participant D as Display
participant S as ShowFileStatistics
U->>D: Request file stats display
D->>S: ShowFileStatistics()
rect rgba(200,230,255,0.25)
note right of S: Use constants for list caps
S->>S: Cap staged by MaxStagedFiles
S->>S: Cap unstaged by MaxUnstagedFiles
S->>S: Cap untracked by MaxUntrackedFiles
end
alt Any list exceeds its max
S-->>D: Include "... and N more"
else All within limits
S-->>D: Show full lists
end
D-->>U: Render statistics
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related issues
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
internal/display/display.go (1)
9-13: LGTM! Constants correctly replace hardcoded limits.The constants are well-named and match the PR objectives perfectly.
Consider making them unexported (e.g.,
maxStagedFiles) since they're only used within this file. This would improve encapsulation while still keeping them within the internal package boundary.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
internal/display/display.go(4 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
internal/display/display.go (1)
internal/stats/statistics.go (1)
GetFileStatistics(14-74)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Package Binaries
🔇 Additional comments (3)
internal/display/display.go (3)
40-52: Staged files section correctly uses MaxStagedFiles.All three occurrences properly reference the constant, maintaining the original display logic.
63-75: Unstaged files section correctly uses MaxUnstagedFiles.All three occurrences properly reference the constant, maintaining the original display logic.
86-98: Untracked files section correctly uses MaxUntrackedFiles.All three occurrences properly reference the constant, maintaining the original display logic.
DFanso
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved 🎊
Summary by CodeRabbit