[player-counter] allow domains and IPs and normalise them properly#138
[player-counter] allow domains and IPs and normalise them properly#138harryyoud wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe ChangesHost Validation and Query Integration
🎯 4 (Complex) | ⏱️ ~45 minutes
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@player-counter/src/Models/GameQuery.php`:
- Around line 74-77: Remove the unnecessary outer parentheses around the return
expression in the method that checks addresses; change the return so it directly
returns the boolean expression using self::normaliseIpAddress($address) !==
false || filter_var($address, FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME) !==
false without wrapping the whole expression in parentheses to satisfy the
no_unneeded_control_parentheses Pint rule.
- Around line 80-85: normaliseIpAddress currently calls
inet_ntop(inet_pton($address)) which throws a TypeError if inet_pton returns
false; change it to first call inet_pton($address), check if that result is
false and return false immediately, then pass the valid binary string to
inet_ntop and return its result; update the function normaliseIpAddress to
perform this two-step check to avoid passing false into inet_ntop.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 5eca8be6-c717-4daf-956a-858c6c03f1f1
📒 Files selected for processing (1)
player-counter/src/Models/GameQuery.php
📜 Review details
🧰 Additional context used
🪛 GitHub Actions: Lint / 0_Pint.txt
player-counter/src/Models/GameQuery.php
[error] 1-1: PHP Pint (Laravel) style check failed: no_unneeded_control_parentheses. 238 files scanned, 1 style issue found.
🪛 GitHub Actions: Lint / Pint
player-counter/src/Models/GameQuery.php
[error] 1-1: PHP CS Fixer/Pint style check failed (Laravel Pint). Rule: no_unneeded_control_parentheses. 238 files checked, 1 style issue. Fix the parentheses usage in this file to satisfy the rule.
🔇 Additional comments (3)
player-counter/src/Models/GameQuery.php (3)
40-65: LGTM!
67-70: LGTM!
102-123: LGTM!
Minor refactor also to minimise duplicated code and to minimise number of times the address is (de)serialized. New methods marked as protected/private as there shouldn't be any need to mess with these downstream.
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
@Boy132 This is now ready for human review |
Minor refactor also to minimise duplicated code and to minimise number of times the address is (de)serialized.
New methods marked as protected/private as there shouldn't be any need to mess with these downstream.
Summary by CodeRabbit