Noosfero :: PatchGuidelines

Login or Register

We, all, everybody... now together!


Patch Guidelines

Get noosfero source code and setup to run the tests

See Getting started with Noosfero development

Create a new branch for your patch

git checkout -b my_hew_branch master

You can put the name you like in your branch.

Write automated tests for your code

Noosfero extensively uses automated tests to make sure we don't break anything when we need to make changes to the system. For that reason, we ask you to always write automated tests together with your patches:

Make sure the existing tests pass with your changes in

One of the reason why we have automated tests is to be relaxed while changing the code knowing that if we break anything the tests will tell us that before our new code goes into a release. So, make sure to run all existing tests (just run `rake` in Noosfero sourcode top directory).

Commit your changes

  1. Add the files that you changed to the commit with: git add path/to/changed/file.rb (repeat this step for every file you changed want to include in the patch)
  2. And then commit your changes: git commit (you should mention an action item, see below)
  3. Write an understandable summary for your patch, describing what your patch does, not what was the problem before it. For example, instead of "Error when doing this and that", write "Fixing error when doing this and that"
    • if you can't write your thoughts down in understandable English, ask for help. smile

Assign an action item to your patch

Every patch must be related to an existing action item, so we can track what was needed to fix a bug or implement a feature. To do this, you should mention an action item in some part of the commit message. You can do that in the end of the message, like the following examples:

If you think it's hard to remember this, you can paste the following code in your .git/hooks/commit-msg:

if ! grep -qs -e '^ActionItem[0-9]\+:' "$1"; then
        echo "You must assign your commit to an existing action item!"
        echo "Please refer to http://noosfero.org/Site/PatchGuidelines"
        exit 1
fi

After pasting, make sure that file is executable (so git will run it before letting you commit) with:

chmod +x .git/hooks/commit-msg

Generate patch

After you commited your change in your private repository, you need to send a patch to the development mailing list. To do that run the following command: git format-patch master..my_branch. Git will leave a file with a name like 0001-my-commit-message.patch in your current directory, that's the patch you should send to the mailing list.

Patch review checklist

This following checklist will be followed for reviewing your patch, so it would be interesting if you do it yourself too before submitting the patch. It's not definitive, and it will certainly grow with time.

Edit Attach Raw text More... Logoff
Login