Style Guide - Papayaman1000/FriendComputer GitHub Wiki

Here's resources on how to style your code for it to remain consistent with the rest of the project.

General Style Preferences

  • Indent with two spaces. Yes, I know that this is a holy war. I know that many of you will hate me for this. Regardless, I ask that you differentiate between indentation levels with two spaces rather than tabs or other numbers of spaces.
  • Try to keep each line at or under 80 characters. This includes the two spaces for every level of indentation. I don't mind the occasional overage ('tis more trouble than it's worth at times), but if you have a line that extends to column 200, then you can almost certainly break that down some.
  • Strings: Use single quotes 'like such'.
  • Brackets, braces, parens:
    • Multiline: Keep opening characters on the same line, with a line break afterwards. Keep closing characters on their own line, excepting related objects (such as an else or another closing character).

    Example:

    if (params) {
      // code
    } else {
      // more code
    }
    // Unrelated code