Skip to content

Contributing

Ales Kozumplik edited this page Sep 10, 2013 · 12 revisions

To have your patches merged:

  1. conform to hawkey's coding style
  2. all unit tests on your branch are passing
    1. preferably with no errors under basic Valgrind check
  3. add unit tests for any new functionality /fixes your branch is providing
  4. if you are extending or changing the lib's interface, reflect the changes in Python bindings
  5. document your changes
  6. make a pull request against the master branch
  7. remember to describe all API changes in the request

Coding Style

C

  • indent width is 4, tabs are used for multiples of eight
  • in Emacs:
  (setq c-basic-offset 4)
  (setq-default indent-tabs-mode t) 
  (setq tab-stop-list 
    '(4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80))
  "Number of spaces that a <Tab> in the file counts for while editing
  set tabstop=8
  
  "Number of spaces that a <Tab> counts
  set softtabstop=4
  
  "Number of spaces to use for each step of (auto)indent (Used for <<, >>, ...)
  set shiftwidth=2
  
  "GNU style indentation
  set cinoptions=>4,n-2,{2,^-2,:2,=2,g0,h2,p5,t0,+2,(0,u0,w1,m1
  
  set autoindent
  • this sucks but is the same as RPM
  • indentation style is 'gnu'
  • max line width is 80
  • avoid curly braces for single-statement blocks. E.g. don't do:
  if (condition) {
    one_thing();
  }

Also see

Clone this wiki locally