DEV Community

mpa-LHutchinson
mpa-LHutchinson

Posted on

Week 12: Release 0.3 pull request 2

Introduction

This week I got my second and final pull request for release 0.3 merged. For this pull request, I had to fix a bug that was happening in a command line tool project. Working on this project was interesting as it was the first time I had to fix a bug, rather than adding a new feature to a project. Given the unfamiliarity with the project itself, completing this issue was the most challenging of all of them so far. I had some troubles configuring the project, to the point where getting the project to work was a harder challenge than fixing the issue.

The issue

Here is the link to the issue:

https://github.com/objectionary/eoc/issues/382

For the issue, I was tasked with fixing a bug with the command line tool. One of the commands available was deleting a directory and its contents. However, even after the successful deletion of a directory, it would print out a message saying the directory doesn't exist.

$ mkdir .eoc
$ eoc clean
The directory .eoc doesn't exist, no need to delete
Enter fullscreen mode Exit fullscreen mode

After reading this, I figured the issue had something to do with the logic of the commands code. I still needed to get the command line to work, which required me to change some permissions in my visual studio. But after getting it to work, I looked in the file that had the code for the clean command.

I eventually found that the logic for deleting a directory was being executed before the check for the directories existence was executed, thus causing the program to always check a nonexistent directory. To fix this, I moved the deletion logic to only execute within the check, so it only executes if the program detects that the directory exists.

Completing the pull request

Once I fixed the bug, I created a pull request, explaining in it why the bug was happening and showing my fix. What scared me at first was when the github actions ran tests on the pull request, and they failed. But the maintainer still approved and merged my fix, and after checking other pull requests I realized the same job would fail on them as well, suggesting that workflow might have an issue and not my fix.

https://github.com/objectionary/eoc/pull/383

Conclusion

Overall I am glad I was able to complete my last pull request for release 0.3. With this blog being concluded, I have now finished release 0.3. Overall I am happy I got to work on more issues since hacktoberfest was my favorite assignment of this class. In the future I will be looking to participate in more events like hacktoberfest in order to expand my skills and help with more open source projects.

Top comments (0)