Not a Fan of Conflict

Safrin
4 min readOct 10, 2020

3 days!! I have been working on my CLI non-stop 3 days. Finally, I can present you something. I am so involved with this project. As this project’s each and every little decision is completely made by me, I can truly say it is MY PROJECT. So, I try to “perfect” it as much as I can.

Before going to the lab, a little update: I updated my tool with some additional feature such as handling redirect status code, passing files from multiple directories and passing multiple URL. You are welcome to check it out.

For this week’s lab I chose following features though I am hoping to add all of them in future:

Feature One

For this one, what I plan vs what I execute is completely different. If you check my issue, I planned to make 3 separate options. I saw most people is also doing the same concept. Then, I tell myself, “why not try something different?. What about instead of making 3 separate options I make just one option?” The problem is there’s 3 different flags. How I am gonna handle that?

After all those question going around my mind, I found a solution: I can pass a configuration file(a valid json file) as my argument where the user can specify the result type good, bad or all. TADA! Here’s how I check if the config file exists or not and if they pass an absolute path or not.

Based on configuration file’s result type, the user will see different results. If user does not specify the result type, the default is all. Here is the commit where you can see how I implement it.

Different output based on config file’s result type

Feature Two

When I read about it, I thought “oh, I just have to make a json object, add the data and print it”. Yes, that’s the main concept. Weirdly, when I print the json object, it was printing one URL twice. I looked all morning today. Where is this coming from? I gave up at noon, just sat quietly for 10 min, stared at the floor, and thought “wow, I can’t even figure out this simple bug. Do I even know anything at all??” Surprisingly, a simple bug has power to make you feel worthless and depressed. Anyhow, after couple of hours self-doubting, I told myself, “You can do it. We won’t rest until we figure out.” I found out this bug existed since the beginning of my project. I was surprised how I or none of PR team did not catch it. It was because sometime line.macth(regex) is returning the same output twice. Hence, there was two copy of URL. Therefore, I just had to check for duplication and if there’s two copy; I remove one. See, it was a simple and silly bug.

Output in JSON format

GitHub Branches and Merges

Another important part of this lab was working on parallel branches. As per instruction, I made two separate branches for two issues and working on both at the same time. I like the idea because you can work on two things at the same time rather than waiting for one to finish. After done with one issue, you are supposed to checkout the master branch and merge the issue branch. Instead of following that, I pushed my issue branch to the master and created a PR. Luckily, before merging I realized my mistake and follow the instruction.

The conflict begins when I tried to merge my second issue.

Merge Failed
Merge Conflict

Fixing the conflict was not hard, but it is tedious. I resolved the conflict, made final edit and merged my second issue to master.

Anything I would do different?

I know for sure something I would do same is: Making separate branch for each issue. The thing I would do different is: I prefer pushing the temporary branch and merging them by creating a PR. Lastly , I want to say even though I struggle all the time, even though I hate bugs, even though the bug makes me cry, even though I feel so angry at myself because of the bug, the RELIEF, the feeling of accomplishment after fixing the bug is so worth it!!! I won’t change anything.

--

--