-
Notifications
You must be signed in to change notification settings - Fork 44
Refactor Launcher #284
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
base: main
Are you sure you want to change the base?
Refactor Launcher #284
Conversation
Reviewer's Guide by SourceryThis pull request refactors the reporter classes to introduce a Sequence diagram for reporter command executionsequenceDiagram
participant User
participant Approvals
participant NamedReporter
participant Launcher
participant DiffTool
User->>Approvals: Verify(data, reporter)
Approvals->>NamedReporter: report(received, approved)
NamedReporter->>NamedReporter: default_launcher()
NamedReporter->>Launcher: send(launcher_name)
Launcher->>NamedReporter: command(received, approved)
NamedReporter->>DiffTool: Execute command
DiffTool-->>User: Show diff
Updated class diagram for Reporter hierarchyclassDiagram
class Reporter
class NamedReporter
class DiffmergeReporter
class FilelauncherReporter
class OpendiffReporter
class TortoisediffReporter
class VimdiffReporter
Reporter <|-- NamedReporter : Inherits from
NamedReporter <|-- DiffmergeReporter : Inherits from
NamedReporter <|-- FilelauncherReporter : Inherits from
NamedReporter <|-- OpendiffReporter : Inherits from
NamedReporter <|-- TortoisediffReporter : Inherits from
NamedReporter <|-- VimdiffReporter : Inherits from
NamedReporter : +default_launcher()
DiffmergeReporter : +command(received, approved)
FilelauncherReporter : +command(received, _)
OpendiffReporter : +command(received, approved)
TortoisediffReporter : +command(received, approved)
VimdiffReporter : +command(received, approved)
note for NamedReporter "Introduced NamedReporter class"
note for DiffmergeReporter "Added command method"
note for FilelauncherReporter "Added command method"
note for OpendiffReporter "Added command method"
note for TortoisediffReporter "Added command method"
note for VimdiffReporter "Added command method"
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
We've reviewed this pull request using the Sourcery rules engine. If you would also like our AI-powered code review then let us know.
Description
Hi, Llewellyn! This is a followup from yesterday's pairing session. You didn't push your branch, but it was useful for me to engage with the code anyway. 😜
This moves us closer to being able to remove
Launcher.The solution
Similar to pairing session: creates a
commandmethod on [some] reporter classes that builds the actual command for that reporter. If we ignore all of the fancy metaprogramming, the only actual knowledge thatLauncherstill has at this point is the names of five reporter classes. (These are the ones that used to be singletons; I removed the Singleton implementation and gave them a temporary superclass ofNamedReporter.)First commit in branch adds characterization tests around the
default_launchermethods for those five reporter classes; those tests can be removed when that method goes away.There are still two distinct sets of reporters: those that inherit from
Reporterand look like proper classes, and the five I've touched in this branch, which still look suspiciously like a glorified data structure (in that they only have one useful static method, and one inherited public instance method that only exists to satisfy the characterization tests that should go away. That's probably for a future pairing session.Notation
Arlo's git notation
Summary by Sourcery
Refactor the Launcher module and reporter classes to simplify the implementation and move towards removing the Launcher module
Enhancements:
Tests:
Chores: