DEV Community

Bregwin Jogi
Bregwin Jogi

Posted on

Working on New Open Source Projects - Release 0.4 - Part 2

Last time, I was planning on what issues I could take on for this assignment, I found a couple more and started working on them.

I looked at another issue on a tool created by GitHub to update how the "time in draft" is calculated for a pull request. When a PR changes from "ready for review" back into "draft", the time is not calculated, so there needs to some updates for it.

Fixing Brave browser bug

Regarding the working on the brave issue, because of the sheer size of the repo, it was tough to find the exact file where the filter lists and global defaults are handled, but I found in an interesting way.

I backtracked the file through VS Code search!

I figured they all must be part of the same file, so I searched for that particular text:
Image description

I saw the actual text is stored in another file to make it easier to modify, I look at the variable name corresponding to it.
Image description

Image description

I saw the file, where is getting used and saw that the components in that file are the same the one I saw in the browser.
Image description

At the top of the file, saw the functions it uses to open the tabs for the filter settings, they were creating the tabs directly, hence the cause of the bug.

I looked into how to focus on a tab if the particular URL is already open an existing tab and updated the code.

Image description

I was worried the issue was going to be a lot harder because I wasn't sure what exactly was causing the issue. But the update seems to fix it.

I made the pull request for it, but I am not sure if it will get merged anytime soon because it is a low priority issue right now.

Fixing issue-metrics bug

For this issue, I looked into where the time in draft is actually calculated and found the following section of code:

Image description

Then I found the function that calculated the draft time, right now it does a subtraction of "ready_for_review" time from "created_at" time.
I noticed that it is using the github3 library for the project and looked at how to get the draft times. While looking at how the ready for review date was calculated, I realized there isn't a direct way to get the draft, and I had to look through the events for that particular issue and get review and draft events.

Then I had to calculate the time from each review and draft interval.

Image description

I then updated the code fix the issue:

Image description

I also updated the tests and added a couple more to test the function.

Image description

Once all the tests passed and everything worked as expected, I made a pull request.

I found another good issue as well, but I will let you know about that and an overview of my everything over the past few months in another blog post!

Top comments (0)