CodeStyleGuidelines

From AWN Wiki

Jump to: navigation, search

Contents

[edit] Coding Style Guidelines for Awn

The following guidelines are requirements for all code that is committed to Awn. It is optional, but recommended, for all code that is committed to the Awn Extras project.

[edit] C

  • Two space indentation
  • All tabs expanded to spaces
  • No trailing whitespace
  • All braces on a separate line
  • All code must compile with the -Werror flag enabled
  • Try and wrap to 80 chars

[edit] Vim modeline

:vim set et ts=2 sts=2 sw=2 ai :

[edit] Artistic Style settings

indent=spaces=2
brackets=break
break-blocks
indent-switches
indent-preprocessor
min-conditional-indent=0
pad=oper
unpad=paren
convert-tabs

[edit] Example

static void
awn_draw_flat_background (AwnWindow *window,
                          gint       width,
                          gint       height,
                          gboolean   draw_border)
{
  gint x, y;
  AwnColor colour1;
  AwnColor colour2;

  if (draw_border)
  {
    draw_border (window, width, height);
  }
  
  /* Draw background */
}

[edit] Python

Python files should conform to PEP 8.

[edit] Vala

To be determined. Most likely this will be similar to the C file guidelines.

Personal tools