If you remember my story on my first two contributions to open source, I had begun implementing some enhancements in Crawler-Commons that would support an enhancement in the StormCrawler project. My changes to Crawler-Commons were accepted, merged, and a new version of the library, 1.1, was published with my enhancements (amongst many things).
Now that the library was published, the dependency on it, in StormCrawler, was updated to use the latest release and I am now able to finish the enhancement in StormCrawler. Here’s how it went:
- I started on the implementation with a few notes in my journal (yes, I sometimes journal about code):
A few days after that, I wrote the code that implements this feature
For the few remaining days before submitting a pull request, I focused on writing unit tests. I ended up writing more unit test code than implementation code, by a large margin (42 lines of implementation code, 220 lines of unit testing code).
Interestingly enough, while writing unit tests for this contribution, I discovered a really minor oversight in the code I submitted to Crawler-Commons. I explained my discovery in my pull request description:
Somewhat related, while implementing this, I noticed that crawler-commons isn't adding the duration attribute from the VideoExtension to the map generated by VideoExtension.asMap() (oversight on my part). I wrote this up as an issue, crawler-commons/300 and submitted a PR. A future release will include duration, however, it will be missing from StormCrawler until a new version of crawler-commons is published with the fix.
- Next, I began the process of submitting a pull request. The pull request guidelines for this project were specified in the Pull Request Template:
Thanks for contributing to StormCrawler, your efforts are appreciated! Before opening a PR, please check that: * You've applied the formatting used by the project with `mvn java-formatter:format` * You've squashed your commits into a single one * You've described what the PR does or at least point to a related issue Thanks!
It was super straightfoorward, except I’ve never squashed multiple commits down into one, manually with Git. I thought to myself, “You gon’ learn today”. Anyway, a Google search, led to a StackOverflow post, which led to an article with two ways to accomplish commit squashing. I chose the following route (the exact Git I wrote to squash!):
git checkout master git fetch git pull git merge sc-749-extension-parsing git reset origin/master git add --all git commit git push
I, effectively, pulled all of my changes onto the latest code in the
master branch and committed it as one commit, instead of several. The other documented method for doing squashes is to use
git rebase. I started down this road first, but it felt a bit like defusing a bomb, to be honest.
- I submitted the pull request. It was approved and merged about a half day later and I got some great feedback.
I won’t be writing about every open source contribution, but I’ll be continuing my contributions.Thanks for reading. ✊🏿