-
Notifications
You must be signed in to change notification settings - Fork 0
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
Next Generation Action System #2
Conversation
This adds a new attribute `actions`, a list of action objects, to Result class. Default actions are added to this list by default. This also changes the `init` and `from_values` method to support bears to pass a list of bear specific actions while yielding a Result object. This list of bear specific actions is added to `actions` attribute.
This adds `init` method to all the existing action classes. This also adds new attriubtes to action classes. Methods of action classes are changed, Result object is removed as a parameter for these methods.
This makes changes in ConsoleInteraction module to use result.actions. This also changes the calls to methods of action classes to comply wih the changes made to the action classes.
This changes the Processing module to use result.actions. This also makes other necessary changes to comply with changes made to action classes.
This changes `provide_all_actions` function to call `get_metadata` method which is a classmethod by class rather than by object.
AddNewLineBear is a action specific to GitCommitBear which will add a newline between shortlog and body of commit message.
@@ -104,9 +104,10 @@ def apply(self, | |||
from coalib.output.ConsoleInteraction import print_result | |||
# Most of the params are empty because they're unneeded in | |||
# noninteractive mode. Yes, this cries for a refactoring... | |||
print_result(printer, None, {}, result, {}, interactive=False) |
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.
I need help with this part, here result object is required as a parameter to print_result
function but now we don't have result object to pass.
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.
Modify the print_result
function then. Idk which is the best way of doing this, but you can directly pass the data needed to print, or maybe creating a new class to hold the data (this seems wrong since we already have a Result class for that), or passing a mocked result object.
Have you considered passing Result object to the actions? What are the downsides of doing that?
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.
Currently, Result objects are passed to actions, but now Result has an attribute actions
which is a list of actions. How can I pass Result to actions which are inside Result itself?
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.
Not passing the same Reuslt object, but creating a new one, in the new object only the data required is provided and everything else will be ignored. This would just 'work', and I don't think this is the way we want to implement. But still you can try it out to test.
Another approach as I mentioned was to create a new class similar to Result and changing the print and other functions as per that (i.e. wherever the result was passed).
@@ -38,7 +39,8 @@ | |||
ShowPatchAction, | |||
IgnoreResultAction, | |||
ShowAppliedPatchesAction, | |||
GeneratePatchesAction] | |||
GeneratePatchesAction, | |||
AddNewLineAction] |
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.
All the new actions created must be added here to support auto-applying of those actions.
Changes to result and existing actions classes.
Modifying ConsoleInteraction and Processing module.
Adding a new action, AddNewLineAction which is specific to GitCommitBear.
To test AddNewLineAction changes must be made in CommitBear which can be found here.