Google Summer of Code 2018 Work Product Submission



coala

Vamshi Krishna Bommerla

I am third year student of B.Tech Computer Science Engineering at Amrita Vishwa Vidyapeetham, Amritapuri, Kerala. I participated in GSoC and worked with coala and GitMate to implement GitMate plugins and automation which help coala development workflow. I worked on adding plugins which auto-reject, auto-review, auto-assign PRs and notify merge conflicts in a PR. I also implemented a assign request plugin to assign issues to a user if he/she satisfies defined eligibilty conditions.


Patches Tarball


SHA-256:

406c470fd6db57b6eeb6c834ce96983adb44235bf3f006124e7b94da039dd17f

Bonding

Phase 1

Phase 2

Phase 3


Links to commits and repositories I've worked on:

Repository Link to Commit/s Description
c  cEPs View

cEP-0024.md: Add cEP for GitMate Plugins

g  gitmate-2 View

Add gitmate pr rejector plugin

I  IGitt View

Commit.py: Add mentioned_issues, closes_issues propeties

g  gitmate-2 View

Upgrade IGitt

g  gitmate-2 View

Add Fixes vs Closes automated checking plugin

I  IGitt View

MergeRequest.py: Add fix_issues, close_issues, resolve_issues properties

g  gitmate-2 View

Auto assign issue based on commit mention in PR

g  gitmate-2 View

apps.py: Add helper function to fetch plugin settings

I  IGitt View

Add Team class

g  gitmate-2 View

Mark PR as WIP if coala plugin detects errors

I  IGitt View

MergeRequest: Add mergeable property

g  gitmate-2 View

Notify merge conflicts in a PR

g  gitmate-2 View

pr_rejector: Support regex in branch names

I  IGitt View

Organization: Add issues property and filter_issues method

I  IGitt View

Repository: Filter issues by label, assignee

I  IGitt View

GitLabUser: Fetch user id from username

m  mr-rebaser View

Add squash pull request command

m  mr-rebaser View

Dockerfile: Install requirements

m  mr-rebaser View

run.py: Update squash command

g  gitmate-2 View

rebaser: Add squash command

I  IGitt View

Issue: Add available_assignees property

g  gitmate-2 View

Add assign and unassign request command

g  gitmate-2 View

Update requirements.txt


Implement GitMate automations and plugins for coala

Work Done

  1. New Plugins added in GitMate-2:
    1. Auto-assign issue based on commit mention in a Pull Request.
    2. Notify merge conflicts in a Pull Request.
    3. Auto review of Fixes vs closes keywords in a Pull request.
    4. Auto reject pull requests opened on specified branches.
    5. Squash commits in a Pull Request.
    6. Request assignment to an issue.
  2. IGitt enhancements:
    1. Filter issues by label, assignee in a repository.
    2. Fetch user id from username in GitLabUser.
    3. Added issues property and filter_issues method in Organization class.
    4. Added fix_issues, close_issues, resolve_issues properties in PullRequest.

Challenges

I had difficulties with implementing GitLab API in IGitt. GitHub has teams and GitLab API doesn’t support teams, so I had to re-design assign request plugin to work without teams. Similarly, GitLab API doesn’t have any webhook for pull request review event, so I couldn’t implement a feature in GitMate which labels pull request as per review done by maintainer.

Work to be done

Mark review labels as per the review

To implement Mark review labels as per the review feature in GitMate, a webhook event is needed which can detect a pull request review. In GitHub, there is a web hook event called PullRequestReviewEvent to know if a PR is reviewed. In GitLab, there are no webhook events that can be detected as a pull request review. If PullRequestEvent webhook needs to be added in IGitt, it needs to support GitLab implementation also. So, this feature couldn’t be implemented as of now.

Merge all pull request review plugins

Initially, the idea was to merge all review plugins like ack, approver, auto label pending review or WIP. But, merging different plugins just because they clear review queue, was a bad idea. Consider code analysis plugin, which marks work in progress if it detects an error, but it doesn’t make sense if it is merged with review plugin. So, I thought of declaring the review labels settings in a new plugin or introduce something like global settings which could be reused by any plugin if needed. There would be an option in required plugins if they want to enable handling review labels in a pull request. There was a delay in implementing this because I couldn’t find a solution for sharing settings between different plugins.