Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #10 +/- ##
===========================================
+ Coverage 92.22% 100.00% +7.77%
===========================================
Files 6 6
Lines 193 176 -17
===========================================
- Hits 178 176 -2
+ Misses 15 0 -15 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR refactors the rule evaluation logic to use Go's idiomatic comma-ok pattern instead of returning pointer values. The main changes update the RuleMatcher function signature from returning *Rule to (Rule, bool), making the code more idiomatic and avoiding nil pointer checks. Additionally, route registration has been extracted into a separate file.
Key Changes
- Changed
RuleMatcherfunction signature to return(Rule, bool)instead of*Rule - Updated
DefaultRuleMatcherimplementation to use range iteration and return value semantics - Extracted HTTP route registration from
handler.gointo a newroutes.gofile
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
internal/flags/evaluator.go |
Updated RuleMatcher type signature and DefaultRuleMatcher implementation to use comma-ok pattern and value semantics |
internal/flags/service.go |
Updated Evaluate method to use comma-ok pattern when calling rule matcher; refactored NewService to delegate to NewServiceWithMatcher |
internal/flags/evaluator_test.go |
Updated all test cases to use comma-ok pattern and verify boolean return values instead of checking for nil |
internal/flags/service_test.go |
Updated custom matcher function to match new signature with (Rule, bool) return |
internal/handler/handler.go |
Removed Register method and net/http import (moved to routes.go) |
internal/handler/routes.go |
New file containing extracted Register method for HTTP route registration |
codecov.yml |
Added routes.go to coverage ignore list |
.testcoverage.yml |
Added routes.go to coverage exclude paths |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # Main entry points and DI wiring | ||
| paths: | ||
| - ^cmd/server/main\.go$ | ||
| - ^internal/handler/routes\.go |
There was a problem hiding this comment.
The exclude pattern is missing the dollar sign anchor at the end. This pattern should use the same format as the existing pattern for consistency and to avoid accidentally matching other files that start with this path. The pattern should be ^internal/handler/routes\.go$ to match only this specific file.
| - ^internal/handler/routes\.go | |
| - ^internal/handler/routes\.go$ |
No description provided.