Hacktoberfest part 1 (OSD600)

For the month of October, I will take part in an event called Hacktoberfest  for an assignment credit in a course I am taking at Seneca College in open source development. The event is held in order to support open source software and get people to contribute to the global programming community. Over the course of the month, if participants make at least 5 pull requests to any public repositories on github, they receive a free Hacktoberfest T-shirt.

Given a great amount of freedom, it was difficult for me to choose what project to begin working on. Not only do I want to pick a project that I think is worth contributing to, but it also needs to be something where I can find an issue that is small enough for me to jump into relatively quickly. I’m not against dabbling in languages I don’t know very well, but I would prefer to do it with good reason.

After some searching, and a lot of being picky, I decided to fix the bug I found in filer for our 0.1 release. I already had some familiarity with the method that had the bug, and I was happy to continue in the same programming language for a bit longer.

Starting with where I left off, I had written two tests for appendFile, which is designed to function in a way that matches appendFile for fs. One test passed when passing { encoding: ‘utf8’, flag: ‘a’ } as the options parameter, but the other failed when passing only { flag:’a’ }. so I carefully looked through appendFile in implementation.js. What I found is that the options parameter is first checked by a function called validate_file_options. But the way it validates it is only to check the type. If it is null, it sets the options to default values. If it is a function, it assumes it was left empty (and sets default values). If it a string, it assumes it is the encoding, and sets a default value for the flag.

But if it is an object, it leaves it alone and passes it along. This is why the test I wrote turned out the way they did. If an object is passed, but that object does not have an encoding specified, then its later checks on the encoding fails since there is no such attribute.

I resolved this by altering the check to account for this, and it ended up passing all tests, including the new ones. After a lot of fiddling with git, I submitted my first Hacktoberfest pull request.

After this I will go back to searching for a new project to work on. I hope to look up various projects that I have used and see if there are any issues appropriate for me.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s