DEV Community

mpa-LHutchinson
mpa-LHutchinson

Posted on

Week 9: Hacktoberfest pull request 4

Introduction

At long last, I got my last pull request for hacktoberfest merged. For this last pull request, I wanted to find an issue that wasn't super challenging but was still more challenging than my previous pull request. I purposefully looked for a project that doesn't use my main language (javascript) and instead uses a different language. Additionally, I looked for a project that I wouldn't immediately understand at first. This issue I feel was perfect for my requirements. In this blog post, I will discuss this pull request as usual but at the end I will also go over 3 pull requests I worked on and (attempted) to get merged, but for one reason or another I didn't want to include them in my release 0.2 assignment.

The Issue

Here is the link to the issue: https://github.com/jessesimpson36/yamldifftool/issues/1

This project is a tool that compares 2 yaml files and writes their differences out to another file. Before I made any changes to the file, the output would always go to the file that the user specifies with the ---output argument. For the issue, I needed to introduce the option to write the output to stdout instead. This was already a bit of a challenge as the code was not immediately readable. But I only had to focus on what mattered: Where the output was going. And at the very bottom of the program I found this code:

with open(args.output, 'w') as outfile:
        yaml.dump(root_diff, outfile, sort_keys=False)
Enter fullscreen mode Exit fullscreen mode

I knew this was what I needed to change. So after some research, I changed it to have a condition. If there was no output argument, it would print the output to "sys.stdout" (I had to add an import for sys at the top of the file)

if args.output:
    with open(args.output, 'w') as outfile:
        yaml.dump(root_diff, outfile, sort_keys=False)
else:
    yaml.dump(root_diff, sys.stdout, sort_keys=False)
Enter fullscreen mode Exit fullscreen mode

I also needed to make changes to the argument parser so the default value is None. This way the condition would work. Once I did this, I got it to work.

Completing the pull request

After this fix, I created a pull request. The maintainer actually noticed an accidental change that I made, and so I corrected it and resent it. The maintainer was very nice about it and I was able to get my final hacktoberfest pull request merged! Here is the pull request:

https://github.com/jessesimpson36/yamldifftool/pull/5

Other Pull Requests

Before I end this blog, I'd like to talk about 3 pull requests I worked on over the course of October that for whatever reason I felt couldn't be included in my release 0.2 assignment.

https://github.com/TheBaljitSingh/Apna-Blog-Frontend/pull/2

This pull request was initially going to be used as my final entry for release 0.2. But after thinking it over, I realized I should find a different one. This issue required me to optimize an image on a blogging site so it would work with a mobile view. The issue also said I could add something else to the homepage. I optimized the image and added a login and signup button on the homepage. However, the maintainer asked me to remove those buttons so my pull request would just include the image optimization. While I do respect the maintainers decision, it was unfortunate since the image optimizing was easy and the buttons required me to think a little bit about how to make the user experience better. The PR was too simple, so I moved on to a different one.

https://github.com/noskofficial/noskofficial.github.io/pull/79

This was actually the first pull request I worked on, and I'm disappointed it didn't get merged. My task was to add some creative things to a homepage, which forced me to think carefully and work with the design elements and theme of the site. After adding around 5 new features to the homepage, I updated the pull request. Unfortunately, the maintainer to this day has not even responded, even though I tried to contact them. It's a shame because I worked harder on this pull request than any others and I would've loved to have it as the final entry.

https://github.com/One-Zero-Code/ngx-toastr-message/pull/19

This pull request I already discussed in my second blog about hacktoberfest. In summary, the task was too simple for me to consider using it given this was supposed to be my third pull request (I just had to update a README file with a couple of lines).

Conclusion

In conclusion, I really enjoyed hacktoberfest. It gave me the opportunity to contribute to several different open source projects and learn what's it's like to work with the maintainers and have my work put out there. It wasn't all perfect, I did have some troubles not only finding good issues to work on but also working with the project maintainers. I handled these issues respectfully, but at the end of the day some things just didn't work out. In the end, this was a great hands on experience of what open source is about: communication, collaboration, and openness. I'm excited to participate in it next year!

Top comments (0)