Skip to content

Latest commit

 

History

History
56 lines (49 loc) · 2.42 KB

style-guide.md

File metadata and controls

56 lines (49 loc) · 2.42 KB
layout
default

Style Guidelines

General Style

  • Indent with tabs, align with spaces. Where something is both indented and aligned, use them properly in combination. This might be confusing in some cases. For example, the below code block is aligned with the list item (three spaces) then indented within the code, AFTER the list item's alignment.

Code Style

  • No trailing whitespace. This doesn't apply to the newline at the end of the file, which is a thing from C and Unix and is required by royal decree.
  • Try to limit yourself to 100 columns. We're not too harsh on this, it's really just a guideline for when you should start breaking up lines and logic.
  • Write inline docs for doxygen. Use Javadoc style for this, not Qt style. We may eventually drop Doxygen, because Doxygen is a bloated pile of ass.
  • Use a modified K&R style for function declarations. The main difference is that we put the arguments on their own line for clarity and ease of alignment: {% comment %} The following bullshit exists because fenced code blocks in kramdown don't seem to work {% endcomment %} {% highlight c %} int main (int argc, char argv[]) { / ... */ while (x == y) { if (x) { do_something(); } else { do_something_else(); } } } {% endhighlight %}
  • Separate logic and presentation. Use classes to build a rough MVC, and then use signals for communication between parts.

Prose Style

  • Use markdown. Don't use anything else, please. We beg of you. Nobody understands groff, and LaTeX, while the results are pretty, the input is not. Just use markdown.
  • Two spaces after each sentence. This is because we mostly work in fixed-width fonts.
  • Hard wrap to 100 columns. We enforce this fairly strictly, with exceptions for links.
  • Prefer reference-style links. They make the source a lot more readable. Put the footnote at the bottom of the section (above the next header)

Commit Style

  • Follow Tim Pope's guide mostly. If you want to get fancy, keep it compatible with markdown. It may not be displayed as markdown, but markdown has pretty code!