Commit 8f9594a
authored
feat(github-api): refactor resolve_reference to eliminate code duplication by extracting common logic into a helper method and using an iterable of reference types (#64)
Refactored the GitHubAPIService.resolve_reference() method to eliminate repetitive code patterns:
Before: Three nearly identical try/except blocks for branch, tag, and commit resolution
After: Single loop over reference types with a helper method for tag lookup
Improvements:
- Reduced 45 lines of repetitive code to ~15 lines
- Eliminated copy-paste maintenance burden
- Made it easier to add new reference types in the future
- Preserved identical functionality and error handling
- Added _get_tag() helper method to handle the special case of tag lookup
All tests pass (88/88) confirming no behavioral changes were introduced.
This refactor improves code maintainability while keeping the same external interface and behavior.1 parent a7a1efa commit 8f9594a
1 file changed
Lines changed: 142 additions & 185 deletions
0 commit comments