Metadata | |
---|---|
cEP | 36 |
Version | 1.0 |
Title | Gitmate for coala |
Authors | Sanchit Gupta mailto:sanchitgupta.072@gmail.com |
Status | Implementation Due |
Type | Process |
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.
Gitmate, a git workflow management bot created by coala, hasn't been actively maintained in the last 3 years. It needs to be updated it and brought back to active use. Various improvements need to be made to Gitmate as well as IGitt, the underlying library that powers Gitmate's git operations.
IGitt and Gitmate are both severely outdated in terms of dependencies. Support needs to be added for the latest versions of python, and most packages need to be updated to their latest versions. IGitt is currently using Jira API v2 which can be upgraded to v3. Currently, Angular is running v4. It needs fundamental changes to upgrade it to v12.
- Docstrings, wherever missing, need to be added to the IGitt codebase.
- 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.
Firstly, cron jobs need to be added for all the supported versions of python. Also, Gitmate hosting needs to be migrated to a new domain before we activate 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
- Allow user to go to ‘/repo/n’ by click on repository card
- Add repository name in title
- Use material chips in text areas
- Make ‘copy plugin’ bar longer
- 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.
- 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 combined 'review' plugin. The models for the combined review plugins should be similar to this:
class Settings(SettingsBase):
wip_label = models.CharField(
max_length=25,
default='status/WIP',
help_text='Label for pull requests that are work in progress')
pending_review_label = models.CharField(
max_length=25,
default='status/pending_review',
help_text='Label for pull requests that need review')
approved_label = models.CharField(
max_length=25,
default='status/approved',
help_text='Label for pull requests that have been approved')
ack_strs = models.TextField(
default='ack, reack',
help_text='Keywords for acknowledging commits, comma separated')
unack_strs = models.TextField(
default='unack',
help_text='Keywords for unacknowledging commits, comma separated')
class MergeRequestModel(models.Model):
repo = models.ForeignKey(
Repository, on_delete=models.CASCADE, related_name='review_mr')
number = models.IntegerField()
acks = psql_fields.JSONField(default=dict)
head_sha = models.CharField(max_length=40, default='')
@property
def ack_state(self):
state = CommitStatus(
Status.SUCCESS, 'This PR is reviewed. :)',
'review/gitmate/manual/pr', 'https://gitmate.io')
for acked in dict(self.acks).values():
if acked['status'] in [Status.FAILED.value,
Status.ERROR.value,
Status.CANCELED.value]:
return CommitStatus(
Status.FAILED, 'This PR needs work. :(',
'review/gitmate/manual/pr', 'https://gitmate.io')
if acked['status'] == Status.PENDING.value:
state = CommitStatus(
Status.PENDING, 'This PR needs review.',
'review/gitmate/manual/pr', 'https://gitmate.io')
return state
@property
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 are
applied when rebase, fastforward, or merge is performed. The
following functions must be added in
responders.py
of rebaser plugin:
def verify_appropriate_label(cmd: str,
pr: MergeRequest,
wip_label: str = 'status/WIP',
pending_review_label: str = 'status/pending_review',
approved_label: str = 'status/approved'):
if(cmd == 'rebase'):
return True
labels = pr.labels
if not approved_label in labels:
return False
def handle_command_fail(pr: MergeRequest,
wip_label: str = 'status/WIP',
pending_review_label: str = 'status/pending_review',
approved_label: str = 'status/approved'):
labels = pr.labels
if not wip_label in labels:
if pending_review_label in labels:
labels.discard(pending_review_label)
else:
labels.discard(approved_label)
labels.add(wip_label)