OSD600 – Release – 0.1

 

Introduction:

From Release-0.1, I learned how to find and fix bug on open source projects. It is mainly divided in to the following steps.

  1. find a bug  in upstream code
  2. issue that bug (github will generate a issue number for you)
  3. fork the upstream code to your own repository
  4. clone the forked code($git clone “url”)
  5. set upstream and origin ($git remote add upstream & $git remote add upstream )
  6. fix that bug locally
  7. test the code after you fix that bug (npm test)
  8. pull request
    1. create and switch a new branch for that issue ($git checkout -b issue-123)
    2. add the file you changed to git ($git add + all_changed_file)
    3. commit your change ($git commit -m “commit words”)
    4. push your change to origin
    5. open pull request (ask upstream to accept your change
  9. review

All these steps are important when we want to declare a issue and pull our requests.

Issue I found:

The issue I found this time is from a open source project called filerjs. It is a POSIX-like file system interface for node.js and browser-based JavaScript. For this open source project a add a test for fs.writeFile-readFile.spec to write a file in non-existing path.

The link to my issue is: https://github.com/filerjs/filer/issues/450

Pull Request:

This is the link of my pull request: https://github.com/filerjs/filer/pull/486

  it('should error when path is wrong to writeFile',function(done){
    var fs = util.fs();

    fs.writeFile('/tmp/myfile', '','utf8', function(error, result) {
      expect(error).to.exist;
      expect(error.code).to.equal('ENOENT');
      expect(result).not.to.exist;
      done();
    });

  });

The test I added to fs.writeFile-readFile.spec will call error when we are trying to write a file in a non-existing path. This code is successfully passed the npm test.

Review:

I also reviewed other contributors’ code about fixing bugs for filerjs.

For example, from one contributor’s pull requestt, I found that he/she is missing one expect if he/she want to test the non-existing of path or file. First of all I praised his contribution to this open source project, then I told him my opinion and what he can add to his code to improve. Hope my suggestion works.

Currently I did not get any comments of my pull request yet. But if any other contributors give me any advises or point out my mistake, I will politely reply their comments, carefully think about their ideas and modify my code if necessary.

Community Involvement

Github provides us a great platform for open source development. Developers can involves, contributes and review each other’s code there. Release-0.1 gives me a chance to understand more about how open source projects works. Reviewing other people’s code gives me a lot of inspirations about how to  write a solid code. I also get some practice to use git and github.

Thank you for reading!

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