My first open source contribution

Like a lot of person programming for living, I’ve always wondered how easy (or how hard, depending of your optimism level) it is to make open source contribution. Moreover listening to a bunch of podcast on computer science, and programming, I’ve heard a lot contributors and maintainers talk about what contributions they made to open source, so I wanted to give it a try too.

Why now ?

Two weeks, when I developed the solution to a Advent of Code problem for my blog, I had faced a problem. A tool that I use, Cppcheck, to add some static analysis checks on the code written of my solution on Advent of Code, gave me some warnings for code coming from a library I used (for information, this is the awesome library JSON for Modern C++).

At that point, I had several solution: I could either ignore them, or report them. So I went to the GitHub repository of the library, I’ve created an issue. But looking at the warnings, I said to myself, why not fix some of them. And here it is, I had a goal, I was ready to achieve it.

From the decision to the contribution

Since the library JSON for Modern C++ is on Github, I am going to describe the contribution process on GitHub.

First step : the Fork

This is the first step to make any contribution to a GitHub open source project.

So I did exactly that, I forked the repository of the library JSON for Modern C++.

Second step : the Commit

Indeed, I’ve got 29 warnings from Cppcheck on the library, but I decided to act on only two of them : an unecessary test and a use of the algorithm std::accumulate instead of a raw loop

I think that I have never been so nervous writing code than when doing those two commits 😆 But it’s good, it made me think a lot about the code I was writing.

Third step : The Pull request

Creating the Pull Request is easy ! You push your branch, go on GitHub, click on the button proposed to create the Pull Request with your branch on the library repository.

The difficult part is to have it accepted by the maintainers. Making it pass all the tests when they are a decent test suite is another difficulty too, but at least, you are more sure that you have broken the library.

What about the Pull Request I’ve created, you may ask. Well, I had to make several fixes when I created it. Indeed, in JSON for Modern C++, you have to run and commit the result of their command make amalgame, which make several thing like formatting the code, and generate some files too. After running this command, and push the modification, then, the tests stop passing, so I've fixed the code I've written, and make it follow the C++11 standard, since I've used a c++14 feature. And after all those corrections, the tests finally passed again 🤘😂🤘 And finally, the Pull Request was approved and merged !

Fourth Step : Enjoy and Celebrate

Conclusion

Moreover, I, now, am more familiar with the contribution process, which is good too. I definitely do it again, and share my experience if I ever get some inside. And writing about also help me to measure how much this experience gave to me.

Hopefully, this post will make you curious to try to contribute too, and until next post, have fun learning and growing 🙂

Originally published at http://10xlearner.com on October 10, 2019.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store