All-Hands-AI / openhands-resolver

A system that tries to resolve all issues on a github repo with OpenHands.
MIT License
85 stars 20 forks source link

Refactoring "if" statements switching between "issue" and "PR" issue-types #179

Closed malhotra5 closed 3 weeks ago

malhotra5 commented 3 weeks ago

This PR addresses the last comment in #174

There are lots of "if" statements switching between issue and PR that we might want to refactor a little later to simplify the logic, but overall this is a good change and we should get it in.

Opened this PR as it was a quick refactor

Summary

  1. Created abstract class in openhands_resolver/issue_definitions.py; IssueHandlerInterface defines an issue handler that must contain the methods get_converted_issues, get_instruction, get_success (functions that previously contained statement switching)
  2. Created IssueHandler which inherits IssueHandlerInterface; this resolves issue-type=issue
  3. Create PRHandler which inherits IssueHandler; this resolves issue-type=pr (inheritance help with modularity)
  4. Refactored test cases in tests/test_resolve_issues.py to work on newly defined classes