My First Open Source Code Contribution

A lot of developers have stickers on their computers. Sometimes the stickers are like pieces of flare. Sometimes, they’re like merit badges. Still, other times the stickers are like a signal flare. Whatever the case, I geek out about them a bit. I see the stickers somewhere in between a merit badge, a piece of flare, and that signal flare.
I have one sticker on my laptop:

https://opensource.org/
See https://opensource.org/ for more info.
This is the logo for Open Source.
Open Source code, documentation, and communities mean a lot to me. The only reason I can do the work I do today (web development primarily on WordPress) is because of open source technologies like Linux, PHP, JavaScript, WordPress itself, and a host of tech too numerous to mention. Not only the tech itself, but the communities around it are typically super helpful and welcoming.
While there is much more to say about my love for Open Source, I wanted to share a specific example of how I actually made my first code contribution to an open source project.

Why is This Special?

I have a few simple plugins in the WordPress Plugin Repo. I also have a theme in the WordPress Theme Repo, so I have those badges as well. However, these were my own projects, not a contribution to other projects. I have wanted to contribute back to the WordPress project however I could since I started developing four years ago. I have contributed a few translated strings to a plugin or two, so I have the Polyglot badge as well. But I’m a develop, and I wanted to contribute code.
So, I’ve started looking for ways to get involved. I have looked at the Good First Bugs in for the WordPress project, and will probably work to commit to that soon. However, I have to really go out of my way to check that board out. I’m sure I can subscribe to it… somewhere…
What I do know is that I also try to follow projects that I’m interested in. One of those project (one I use pretty regularly) is WP-CLI. I’ve grown to use WP-CLI for a lot of simple tasks:
  • Site setup
  • Database exporting, searching and replacing and importing (migration)
  • Installing, activating, deactivating, and deleting plugins and themes
  • Running checksums to make sure the core WP install is all good (this is probably my favorite, as it’s saved my butt a couple times)
  • And oh so much more!
The maintainers of the project also have the ability to subscribe to updates from them. Something they include with regularity is Good First Issues (not bugs, per se, but GitHub issues). I tend to peruse these, always looking for something simple I can help with. I finally found one:

They Made It Easy

Not only do the maintainers hand you these easy Issues, they do their best to be quick to respond to your questions and clarifications. I had a few and Daniel Bachhuber was very responsive.
Not only this, but Alain Schlesser had already done most of the programming work. I only needed to come up with arguments for an array.
It. Couldn’t. Be. Simpler…
While I did need some clarification on process and where exactly to edit the code, the maintainers had already gone through great links to make sure getting set up to contribute to WP-CLI was easy. The step-by-step documentation was straightforward and there were no surprises.
Once I had the clarification and direction I needed, adding 15 lines of code was dead simple. All I needed to was make sure my fork and branch were working and the new conditional was returning as expected. After that, I made my way through the WP-CLI documentation (also excellent!), and looked for possible scenarios were someone would mis-type a parameter for a command.
After I’d tested the code several times and I was pretty sure it’d be ok, I pushed it my forked repo and clicked the Pull Request ( PR ) button. Yep, GitHub makes it easy too! I labeled the PR a Work in Progree [WIP], since this was my first go at the commit and I wanted to make sure it was what they were looking for.
Apparently it was, because Daniel and Alain both responded quickly and the code was merged.
I couldn’t believe it. I had just contributed!

Contributing Ain’t Scary!

Going forward, I’ll hopefully continue to contribute to WP-CLI, and other WordPress issues. This was a great experience for my first contribution. Why?
  • Asking questions helped me clarify what I needed to do
  • Quick responses to my questions
  • Clear and easy to follow documentation
  • A simple, repeatable process to submit a PR and have the code reviewed.
You can get involved with WP-CLI here.
I’m looking forward to doing more.
Cheers,
Nate
Filed under: Web Development, What I LearnedTagged with: , , ,

No comment yet, add your voice below!


Add a Comment

Your email address will not be published. Required fields are marked *

Comment *

Name *
Email *
Website