Skip to content

Latest commit

 

History

History
166 lines (113 loc) · 4.37 KB

HACKING.md

File metadata and controls

166 lines (113 loc) · 4.37 KB

Hacking

Getting the source code

$ git clone https://github.com/analizo/analizo.git

Installing Dependencies

Run this command:

  $ sudo ./development-setup.sh

If you are using Debian, the script will do everything you need.

If you are using another system, you will have to install some dependencies first. Check the "Installing dependencies on non-Debian systems" below.

Running the test suite

Just run rake in the root of the sources:

$ rake

See "Installing Dependencies" above for a guide to install all the software that's needed to run Analizo tests.

Style and Good practices

Always write automated tests for your code:

  • if you are adding a new feature, write a new cucumber feature file that shows how the feature is expected to work
  • if you are fixing a bug, make sure that you add a test that fails because of the bug, and then work on a fix to it.
  • If removing any code does not make any test to fail, then that code can be removed at any time.
  • Make sure the existing tests still pass after you change, add or remove any code.

Refactoring code to make it simpler, easier to change or extend is always a good thing. Just make sure that the entire test suite still passes after you do any refactoring.

Use 2 indentation of 2 spaces.

Please always put the opening curly brace of a block in the same line of the corresponding instruction (e.g. if, for etc).

Good:

if (...) {
  ...
}

Bad:

if (...)
{
  ...
}

Always "use strict" in the top of new modules.

Don't bother changing the AUTHORS file. It's automatically generated as part of the release process. See the Rakefile for more information.

Sending patches

Send the patches to the Analizo mailing list: [email protected] (see subscription instructions at librelist.com homepage) or to [email protected]. Or create a pull request on github.

To create a patch:

$ git clone git://gitorious.org/analizo/analizo.git
$ cd analizo
$ edit file
$ git commit file
$ git format-patch origin

This will generate patch files named like 0001-message-you-typed-for-the-commit.patch.

If you want to make several changes, please consider making one commit (and therefore one patch) for each different logical change you want to make. In this case, after running git format-patch you'll have a series of patch files named like 0001-..., 0002-..., just send them all.

You are encouraged to learn how to use git since it's a powerful version control system and it can make it easy for you to keep in sync with Analizo development.

Please write good commits messages. Read the following two links, and use common sense:

Patches with multiple authors should list the authors in the end of commit message, using a Signed-off-by tag, one author per line. Example:

  Signed-off-by: John Doe <[email protected]>
  Signed-off-by: Random Hacker <[email protected]>

See commit 005c3bff4e0809eae0340e7629678186d1621930 for an example.

Installing dependencies on non-Debian systems

  1. Install Doxyparse build dependencies: flex, bison, libqt4-dev, gcc, gcc-c++, and git (your operating system probably already has packages for these)

  2. Install Doxyparse

$ git clone git://gitorious.org/analizo/doxyparse.git
$ cd doxyparse
$ ./configure --with-doxyparse
$ make
$ sudo install bin/doxyparse /usr/local/bin/
  1. Install sloccount - http://www.dwheeler.com/sloccount/sloccount.html

  2. Install Ruby packages required

  • Make sure you have Rubygems installed. If you have a recent enough version of Ruby, you should already have Rubygems.
$ gem install rake rspec cucumber
  1. Install Rake - http://rake.rubyforge.org/
  • your operating system probably already has a pre-built package for it
  • otherwise follow the installation instructions on the website
  1. Install rubygems - http://docs.rubygems.org/
  • your operating system will probably already have a pre-build package for it.

If you have Ruby installed, you may already have rubygems installed as well.

  1. Install cucumber and rspec using rubygems
$ gem install cucumber rspec
  1. Make sure you also have man and sqlite3 installed.