Skip to content
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

cEP-0031: Improve Generic Bear Quality #184

Merged
merged 2 commits into from
Jun 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ in the `cEP-0000.md` document.
| [cEP-0027](cEP-0027.md) | coala Bears Testing API | This cEP describes the implementation process of `BaseTestHelper` class and `GlobalBearTestHelper` class to improve testing API of coala as a part of the [GSoC'18 project](https://summerofcode.withgoogle.com/projects/#6625036551585792). |
| [cEP-0029](cEP-0029.md) | Support TOML as a configuration format | This cEP describes the implementation process how support for TOML will be implemented and integrated with the existing configuration system as a part of the [GSoC'19 project](https://summerofcode.withgoogle.com/projects/#6388671438127104). |
| [cEP-0030](cEP-0030.md) | Next Generation Action System | This cEP describes the details about Next Generation Action System which will allow bears to define their own actions as a part of [GSoC'19 project](https://summerofcode.withgoogle.com/projects/#5450946933424128). |
| [cEP-0031](cEP-0031.md) | Improve Generic Bear Quality | This cEP describes the improvement in the generic bears currently available along with the implementation of the new bears as a part of the [GSoC'19 project](https://summerofcode.withgoogle.com/projects/#4866569388163072). |
| [cEP-0036](cEP-0036.md) | Gitmate for coala | This cEP describes the improvements to IGitt and Gitmate, which include upgrading dependencies, making it functional, changes to plugins, etc. as a part of the [GSoC'21 project](https://summerofcode.withgoogle.com/projects/#6263057774280704). |
2 changes: 1 addition & 1 deletion cEP-0029.md
Original file line number Diff line number Diff line change
Expand Up @@ -299,10 +299,10 @@ $ coala --create-coafile .coafile.toml

The loaded sections from either .coafile or .coafile.toml
can be supplied to:

- TomlConfWriter to create TOML config file
- ConfWriter to create coafile


### Support coala-quickstart to generate config files in TOML.

coala-quickstart will be made to generate config files in TOML.
Expand Down
36 changes: 18 additions & 18 deletions cEP-0030.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@
# Abstract

This cEP describes the details about Next Generation Action System which
will allow bears to define their own actions as a part of
will allow bears to define their own actions as a part of
[GSoC'19 project](https://summerofcode.withgoogle.com/projects/#5450946933424128).

# Introduction

Bears run some analysis on a piece of code and output is in the form of
a `Result` object. Then some action from a predefined set of actions
is applied to that `Result` object. This system is a bit restrictive
as only an action from predefined set of actions can be taken.
If there is a system which will support bears defining their
Bears run some analysis on a piece of code and output is in the form of
a `Result` object. Then some action from a predefined set of actions
is applied to that `Result` object. This system is a bit restrictive
as only an action from predefined set of actions can be taken.
If there is a system which will support bears defining their
own actions, then it will make bears more useful.
This project is about modifying the current action system so that bears
This project is about modifying the current action system so that bears
can define their own actions.
This project also aims to implement a new action which will help in
supporting for bears to provide multiple patches for the affected code.
Expand Down Expand Up @@ -63,7 +63,7 @@ class Result:
applied_actions: dict = {},
actions: list = []):

# A new attribute `actions` is added
# A new attribute `actions` is added
self.actions = actions

# A new parameter `actions` is added
Expand Down Expand Up @@ -102,7 +102,7 @@ class Result:
## Modifying `ConsoleInteraction` module

1. `ConsoleInteraction` module needs to be modified to add the actions in
`result.actions` to the list of predefined actions when asking user
`result.actions` to the list of predefined actions when asking user
for an action to apply
2. For this `acquire_actions_and_apply` function needs to be modified.

Expand Down Expand Up @@ -156,7 +156,7 @@ def autoapply_actions(results,
file_diff_dict,
section,
log_printer=None):

bear_actions = []
# bear defined actions from all the results are added to `bear_actions`.
for result in results:
Expand Down Expand Up @@ -188,7 +188,7 @@ def autoapply_actions(results,

# This condition checks that if action is in bear_actions which means
# that default action is one defined by a bear, then action must be in
# result.actions because then only that action can be applied to that
# result.actions because then only that action can be applied to that
# result.
if action not in bear_actions or action in result.actions:
applicable = action.is_applicable(result,
Expand Down Expand Up @@ -243,7 +243,7 @@ def get_default_actions(section, bear_actions):

# `action_dict` now contains all the actions from `ACTIONS` as well as
# bear_actions.
# bears_actions contain action objects, to be consistent with this
# bears_actions contain action objects, to be consistent with this
# `ACTIONS` was changed to contain action objects.
action_dict = {action.get_metadata().name: action
for action in ACTIONS + bear_actions}
Expand All @@ -264,13 +264,13 @@ def get_default_actions(section, bear_actions):
```

4. Auto applying actions specific to bears is same as auto-applying
predefined actions. Users just need to add
predefined actions. Users just need to add
`default_actions = SomeBear: SomeBearAction` in coafile to autoapply
`SomeBearAction` on a result whose origin is `SomeBear`.

## Writing bear specific actions

1. The above changes will now allow bears to define their own actions and
1. The above changes will now allow bears to define their own actions and
user can apply these actions interactively or by default.
2. While writing any bear specific actions user must implement
`is_applicable` and `apply` method with correct logic. User can also add a
Expand Down Expand Up @@ -321,9 +321,9 @@ class EditCommitMessageAction(ResultAction):

### AddNewlineAction for GitCommitBear

1. `AddNewlineAction` is an action specific to `GitCommitBear`. Whenever
`GitCommitBear` detects that there is no newline between shortlog and
body of the commit message it will yield a `Result` and pass
1. `AddNewlineAction` is an action specific to `GitCommitBear`. Whenever
`GitCommitBear` detects that there is no newline between shortlog and
body of the commit message it will yield a `Result` and pass
`AddNewlineAction` as an argument.

```python
Expand Down Expand Up @@ -413,7 +413,7 @@ class Result:
actions: list = [],
alternate_diffs: (list,None) = None):

# A new attribute `alternate_diffs` is added
# A new attribute `alternate_diffs` is added
self.alternate_diffs = alternate_diffs

# A new parameter `alternate_diffs` is added
Expand Down
Loading