GSoC 2017 GSoC

Past couple of months, I have been contributing to Homebrew as a GSoC project. This post summarizes the work that has been done, and the road ahead.

Summary

All Pull Requests in Homebrew/brew by me can be accessed here:

   List of all the above PRs (both merged/open) (Click to expand)

Pull requests that got merged during GSoC work period:

Pull requests still under review:


Stats

Welcome: Your first project
Infogram

Project Description

This project implements RuboCop custom cops to check Homebrew’s coding style violations programmatically. More details can be found here and here.

Project Learnings

Searching through the whole git history has been very helpful, as it would mostly lead me to the first PR where the concerned contributor or maintainer would have written about the code. PR checklist template FTW!

I learnt to test my code extensively before opening a PR. The importance of this cannot be stressed enough. Do not ever be negligent and assume that your code will always work. Then things will break when that nasty edge case is encountered.

I also learnt to not be afraid and jump into source code instead of reading the docs. RuboCop has a more user driven documentation, while documentation of its internals is rather scarce. By going through the source of RuboCop, I came across an undocumented and a powerful feature of RuboCop. It greatly simplified some parts of my GSoC Project. Also, I reported a bug, and contributed in writing a new cop in RuboCop project. I also got to understand how certain aspects of RuboCop offense checks work, thus preventing unexpected bugs in Homebrew.

The reason why 3 out of the 15 methods could not be ported is because RuboCop runs in a separate process and these methods use Homebrew’s internals, hence are not available in that process. Unix sockets for interprocess communication(IPC) could be used but making it complicated is just not worth it.

Road ahead

Whilst the audit rules have been ported to RuboCop cops, few of them have autocorrect. Now I would be looking at adding autocorrect methods, so correcting the style offenses across huge number of Formulae can be automated. I also look forward to continue contributing to Homebrew. Its the project which makes macOS usable to developers and I myself use brew heavily on a day to day basis.

Over all, it has been an amazing experience for me, working on a popular project, with awesome supportive friendly talented mentors (MikeMcQuaid & Jcount) and co interns.

Credits

This project would never have gotten to this stage without the code reviews and discussions with my mentors. A huge shout out & sincere Thanks to all the mentors at Homebrew (MikeMcQuaid, Jcount, ilovezfs, alyssais, apjanke , woodruffw, bfontaine & others) and amazing people at Google for this opportunity and giving a headstart in OSS. You simply rock!

Until next time and May the source be with you!