Google Summer of Code 2019 Work Product Submission



coala

Akshat Karani

I’m a third year student of Computer Science & Engineering at Indian Institute of Technology, Dharwad. I am enthusiatic about contributing to open source and working on my own projects. I participated in GSoC and worked with coala to provide support for bears to define their own custom actions. I also provided support for bears to suggest multiple patches for a problem.


Project Tarball

Bonding

Phase 1

Phase 2

Phase 3


Repository Link to PR Description
c  cEP View

cEP for the Project

c  coala View

Fixing color_letter function in ConsoleInteraction module

c  coala View

Adding actions attribute to Result class

c  coala-bears View

EditCommitMessageAction and AddNewlineAction for GitCommitBear

c  coala View

Tutorial for writing bear specific actions

c  coala View

Implementing AlternatePatchAction and support for bears to provide multiple patches

c  coala-bears View

DeleteFileAction for DuplicateFileBear

c  coala-bears View

Providing multiple patches for FilenameBear

c  coala View

Update the docs to explain how bears can suggest multiple patches


Next generation action system

Work Done
  • Made some changes to action_dict, now the key of the dictionary is id of the object rather that name of the class.

  • Updated the color_letter function in ConsoleInteraction module to display the action on console properly.

  • I added two new attribute to Result class:

actions attribute which is a list of action instances and allows bears to define their own actions.

alternate_diffs attribute which is a list of dictionaries where each element is an alternate patch.

  • Implemented some bears specific actions:

EditCommitMessageAction for GitCommitBear which opens an editor in which user can edit the commit message.

AddNewlineAction for GitCommitBear which adds a newline between shortlog and body of commit message when applied.

DeleteFileAction for DuplicateFileBear which deletes one of the duplicate file.

  • Wrote a tutorial which describes how to write bear specific actions.

  • Updated FilenameBear to provide multiple patches wherever it cannot guess the naming convention to use.

  • Updated the docs to briefly explain how bears can suggest multiple patches.

Challenges

It was a great learning experience overall, and I did face a few problems throughout but I was able to tackle/workaround them with help of my mentors. The first problem I faced was allowing bears to define their own actions without affecting the default actions. There were many possible options to implement this and selecting one which would be feasible and works was a difficult task. Also allowing multiple patches without making huge changes in existing framework was challenging. Writing tests for some of the actions implemented which involved deleting a file or amending commit messages was tricky.

Work to be done

Main advantage after this project is that now many useful custom actions can be implemented for bears. Identifying where custom actions can be useful and implementing them will be a community driven process. Another thing which can be done is extending some of the existing bears to provide multiple patches. Also allowing actions to be initialized with a custom description would be really helpful. Currently actions have a default description and a with feature like above it will be possible to display an action specific description which would be helpful to the user particularly incase of AlternatePatchAction, which is currently displayed as Show AlternatePatch.