Making Changes and More CLI Stuffs
Welcome back everyone to my blog everyone! This post is about my process doing lab 2 for the open source class I am in. For this lab, our objective was to work with each other and add an optional requirement to out release 0.1. For those who do not know or need a refresher on what release 0.1 is, it was to make a Command Line Interface that would check for dead links. You can find my progress on it right here in my blog! Anyway, lets begin with my lab 2 quest, journey or whatever escapade you wish to call it.
So our first step was to choose a partner, I teamed up with Sanjida Afrin, a good friend and colleague of mine. Both of us agreed to work together on our release 0.1’s and it was a fun experience. I also had another colleague, Ekaterina Grinberg also do a pull request on my repo which was super awesome. However, this blog isn’t about my repo, it’s about what I did with my lab partner and their release 0.1 so lets get back on track. The first thing I did was ask what features weren’t added, I could already tell by the code that you could only pass in one file at a time. I figured this would be an easy fix because unlike my code which has a disgustingly bloated function doing almost all the work, Sanjida actually made separate functions and did good coding practice! This meant that implementing this would be super easy. All I needed to do was change what the -f argument accepted from a string to an array, then make the readFile() function read each element in the passed in argument array. The rest of the code should be functionally the exact same as it’s just handling the files still.
I then looked for other things that I could add before I started programming as I felt that only doing one thing was somewhat of a half finished job. I noticed that when testing, the tool would take a very very long time on certain URLs which made me think it crashed. As it turned out it had trouble handling DNS and timeout URLs. This was something my own CLI would handle so I knew what to do. Simply make sure if the url won’t open within a certain time frame, then mark it as an error. The other thing I noticed was that it would take the entire status and not just the head, which contains the status code. So I figured that’s another one line fix.
After I figured out what I would be doing, I put an issue in and got to work. I made a branch from the forked repo and started coding. It was relatively simple coding so I won’t bore you with the implementation. However I did run into an issue which was entirely my fault and made me lose a good hour I’m never getting back. I installed the app through doing `npm install -g https://github.com/sanji11/find-broken-link` but I neglected that this was an online file and not the one I forked into my repository, so when I cloned the repo and changed it, I wasn’t doing it on the right version. After figuring it out it worked wonderfully afterwards. So for reference for myself and everyone; MAKE SURE YOU ARE WORKING ON THE RIGHT THING!!
After that was done I pushed my branch and made a pull request, which actually worked this time! I discussed with Sanjida for a while about each other’s code and our pull requests and what else to add. I forgot to update the Readme.md file to say that it can accept other files which was the only thing I needed to do. After doing that one change, she accepted my pull request and I was finished! Overall this lab was a great and fun experience being able to work with a good friend of mine. It was also a healing one after my last failure with git in lab 1. That’s all I have for today, if you enjoyed reading this then leave a comment and I’ll respond as soon as I can. Thanks for coming and stay safe! Happy spooky month everyone!