From 4e20d96f732ea23dd56db69bdc2f27a425ea2d1d Mon Sep 17 00:00:00 2001 From: Abhinav Kaushlya Date: Sun, 6 Jun 2021 11:55:16 +0530 Subject: [PATCH] Fix remark issues for recent changes --- cEP-0029.md | 2 +- cEP-0030.md | 36 ++++++++++++------------- cEP-0031.md | 48 ++++++++++++++++----------------- cEP-0036.md | 76 ++++++++++++++++++++++++++++++----------------------- 4 files changed, 86 insertions(+), 76 deletions(-) diff --git a/cEP-0029.md b/cEP-0029.md index 8cbefbe6c..3f71df426 100644 --- a/cEP-0029.md +++ b/cEP-0029.md @@ -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. diff --git a/cEP-0030.md b/cEP-0030.md index ec12a949a..bd465cb04 100644 --- a/cEP-0030.md +++ b/cEP-0030.md @@ -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. @@ -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 @@ -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. @@ -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: @@ -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, @@ -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} @@ -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 @@ -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 @@ -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 diff --git a/cEP-0031.md b/cEP-0031.md index 699601511..c79f7e3a5 100644 --- a/cEP-0031.md +++ b/cEP-0031.md @@ -20,28 +20,28 @@ along with the implementation of the new bears as a part of the coala has few generic bears which have the potential to perform better fixing some of the issues in them. Some of these issues are as follows: -- [coala/coala-bears#644][644]: Ignore doc comments/doc strings - Comments or docstrings do not have any set standards while the - IndentationBear does not ignore them in a file. IndentationBear checks for - correct indentation in the program statements since that is crucial for - proper code style. Docstrings/comments, on the other hand, do not have any - such compulsion. So ideally docstrings should be ignored by the bear. coala - already uses documentation extraction algorithms in DocumentationStyleBear. - Using the existing algorithms and constructing ignore ranges out of the - extracted comments inside the IndentationBear, this issue can be solved. - -- [coala/coala-bears#1897][1897]: Show PEP8 error description - On running PEP8Bear the default message is 'The code does not comply to - PEP8.' which is not very helpful for the user. This issue can be solved - by improving autopep8 itself. One of the alternative approach is to - invoke pycodestyle inside PEP8Bear and pass the issues to the autopep8 - and generate a fix for them using `--line-range`, `--column-range` and - `--select` options. - -- [hhatto/autopep8#227][227]: Create diff for a specific pep8 issue - User should have a choice of selecting the issue he wants to generate a fix - for. This issue is related to the above issue since the fix for this issue - will introduce a new setting `--column-range` in autopep8. +- [coala/coala-bears#644][644]: Ignore doc comments/doc strings + Comments or docstrings do not have any set standards while the + IndentationBear does not ignore them in a file. IndentationBear checks for + correct indentation in the program statements since that is crucial for + proper code style. Docstrings/comments, on the other hand, do not have any + such compulsion. So ideally docstrings should be ignored by the bear. coala + already uses documentation extraction algorithms in DocumentationStyleBear. + Using the existing algorithms and constructing ignore ranges out of the + extracted comments inside the IndentationBear, this issue can be solved. + +- [coala/coala-bears#1897][1897]: Show PEP8 error description + On running PEP8Bear the default message is 'The code does not comply to + PEP8.' which is not very helpful for the user. This issue can be solved + by improving autopep8 itself. One of the alternative approach is to + invoke pycodestyle inside PEP8Bear and pass the issues to the autopep8 + and generate a fix for them using `--line-range`, `--column-range` and + `--select` options. + +- [hhatto/autopep8#227][227]: Create diff for a specific pep8 issue + User should have a choice of selecting the issue he wants to generate a fix + for. This issue is related to the above issue since the fix for this issue + will introduce a new setting `--column-range` in autopep8. Along with fixing these issues, new bears including `OutdatedDependencyBear`, `RegexLintBear`, `FileModeBear` and `RequirementsCheckBear` @@ -66,7 +66,7 @@ The bear will require changes to the existing [package_manager][package_manager] with the help of new additions to the requirement classes. - For pip requirements, we could use the PyPI JSON API which provides the - version info by specifying the `package_name`. + version info by specifying the `package_name`. ```py from xmlrpc import client @@ -84,7 +84,7 @@ class PipRequirement(PackageRequirement): ``` - For npm dependencies, we can use the npm cli command `npm outdated` which - produces an output as below: + produces an output as below: ``` $ npm outdated diff --git a/cEP-0036.md b/cEP-0036.md index 3370bf739..ed732b09a 100644 --- a/cEP-0036.md +++ b/cEP-0036.md @@ -32,16 +32,16 @@ changes to upgrade it to v12. ## Changes to IGitt -* [Docstrings, wherever missing, need to be added to the IGitt -codebase][2]. -* IGitt documentation needs to be updated to reflect changes occurring due to -migration from Gitmate to coala organisation. Also, a section can be added on -how IGitt codebase is structured, examples can be written for those actions -missing currently like notifications, reactions etc, and a section on how to -use and set up and use for developers can be added too. -* Cron jobs are currently missing for different versions of python, so they -need to be added after adding support for latest versions. -* coala-IGitt needs to be published as a separate package. +- [Docstrings, wherever missing, need to be added to the IGitt + codebase][2]. +- IGitt documentation needs to be updated to reflect changes occurring due to + migration from Gitmate to coala organisation. Also, a section can be added on + how IGitt codebase is structured, examples can be written for those actions + missing currently like notifications, reactions etc, and a section on how to + use and set up and use for developers can be added too. +- Cron jobs are currently missing for different versions of python, so they + need to be added after adding support for latest versions. +- coala-IGitt needs to be published as a separate package. ## Changes to Gitmate @@ -56,33 +56,33 @@ Gitmate. Multiple improvements can be made to the frontend. These include **UI changes** such as: -* Remove the use of German -* Remove the list of sponsor companies -* Revamp landing page -* Fix 'copy plugin settings': dropdown should not show 'suggested password' -* Make spinner go away after activating gitmate on a repository -* Fix buggy slide toggles -* [Fix alignment of toggles for suboptions][3] -* Allow user to go to ‘/repo/n’ by click on repository card -* [Add repository name in title][4] -* [Use material chips in text areas][5] -* [Make ‘copy plugin’ bar longer][6] -* Improve design of repository cards +- Remove the use of German +- Remove the list of sponsor companies +- Revamp landing page +- Fix 'copy plugin settings': dropdown should not show 'suggested password' +- Make spinner go away after activating gitmate on a repository +- Fix buggy slide toggles +- [Fix alignment of toggles for suboptions][3] +- Allow user to go to ‘/repo/n’ by click on repository card +- [Add repository name in title][4] +- [Use material chips in text areas][5] +- [Make ‘copy plugin’ bar longer][6] +- Improve design of repository cards **Frontend documentation** can be improved and the following changes can be made: -* Improve developers section - Fix broken links, improve part about setting -environment variables -* Complete FAQ.md -* Add a section on how the Gitmate codebase is structured. +- Improve developers section - Fix broken links, improve part about setting + environment variables +- Complete FAQ.md +- Add a section on how the Gitmate codebase is structured. ### Changes to backend -* Docstrings, wherever missing, need to be added to the backend codebase. -* The **‘ack’**, **‘approver’**, and **‘auto label pending or wip’ plugins** -need to be merged into [a][7] [combined][8] ['review'][9] [plugin][10] -. The models for the combined review plugins should be similar to this: +- Docstrings, wherever missing, need to be added to the backend codebase. +- The **‘ack’**, **‘approver’**, and **‘auto label pending or wip’ plugins** + need to be merged into [a][7] [combined][8] ['review'][9] [plugin][10]. + The models for the combined review plugins should be similar to this: ```python class Settings(SettingsBase): @@ -137,9 +137,9 @@ class MergeRequestModel(models.Model): def igitt_pr(self): return self.repo.igitt_repo.get_mr(self.number) ``` -* The rebaser plugin needs to be changed to ensure that the [proper labels][11] are -applied when rebase, fastforward, or merge is performed. The -following functions must be added in `responders.py` of rebaser plugin: +- The rebaser plugin needs to be changed to ensure that the [proper labels][11] are + applied when rebase, fastforward, or merge is performed. The + following functions must be added in `responders.py` of rebaser plugin: ```python def verify_appropriate_label(cmd: str, @@ -169,13 +169,23 @@ def handle_command_fail(pr: MergeRequest, ``` [1]: https://summerofcode.withgoogle.com/projects/#6263057774280704 + [2]: https://gitlab.com/gitmate/open-source/IGitt/-/issues/146 + [3]: https://gitlab.com/gitmate/open-source/gitmate-2-frontend/-/issues/104 + [4]: https://gitlab.com/gitmate/open-source/gitmate-2-frontend/-/issues/83 + [5]: https://gitlab.com/gitmate/open-source/gitmate-2-frontend/-/issues/81 + [6]: https://gitlab.com/gitmate/open-source/gitmate-2-frontend/-/issues/66 + [7]: https://gitlab.com/gitmate/open-source/gitmate-2/-/issues/242 + [8]: https://gitlab.com/gitmate/open-source/gitmate-2/-/issues/375 + [9]: https://gitlab.com/gitmate/open-source/gitmate-2/-/issues/376 + [10]: https://gitlab.com/gitmate/open-source/gitmate-2/-/issues/243 + [11]: https://gitlab.com/gitmate/open-source/gitmate-2/-/issues/144