Skip to content

Dev Guide

Kyle Hennig edited this page Oct 22, 2020 · 2 revisions

Style Guide

A couple of style guide rules should be followed in this repo:

Code-structure related:

  1. Use 4-space indenting
  2. Use Unix-style line endings (LF)
  3. Trim whitespace at the end of lines
  4. End file with a newline
  5. Indent comments to the same indentation level as the code they refer to

Branch and commit naming related:

  1. Name branches after user story number they correspond to.

    Example: 03.01.10 or 03.01.10-testing

  2. Prefix commit messages with the user-story they correspond to

    Example: 03.01.10: Refactors getBook() method

The goal of these rules is simply to define a standard which improves git workflows, traceability, and code readability. The exact values of the rules (spaces over tabs, etc.) are not chosen because one value is necessarily better than the other, but are rather just arbitrary defaults for consistency.

Editor Setup

Most of these style guide rules can be handled automatically by your editor of choice. A .editorconfig file has been provided to configure your editor to meet our standards. Visual Studio Code requires you install the EditorConfig plugin. Android Studio will be automatically configured.

Below are a handful of configuration guides, feel free to add your program of choice if it's missing.

VSCode

In your settings.json file (which can be opened from the main settings page), add the following. Note that most of these are defaults anyways, but are explicitly stated here if you want to make project-level settings that conflict with global settings:

"editor.insertSpaces": true,
"editor.tabSize": 4,

"files.eol": "\n"

"files.trimTrailingWhitespace": true,
"editor.trimAutoWhitespace": true,

"files.insertFinalNewline": true,
"editor.renderFinalNewline": true // If you want to make sure it worked

Android Studio

Access the settings with File/Settings. (There may be config files that could be edited as plain text, but here are the menu entries just to start.)

  • Editor/Code Style/[Language]/Tabs and Indents/Use tab character: Uncheck

  • Editor/Code Style/[Language]/Tabs and Indents/Tab Size: 4

  • Editor/Code Style/General/Line separator: Unix and macOS (\n)

  • Editor/General/Strip trailing spaces on save for: All

  • Editor/General/Ensure an empty line at the end of a file on Save: Checked

  • Editor/Code Style/[Language]/Code Generation/Comment Code/Line comment at first column: Uncheck

  • Editor/Code Style/[Language]/Code Generation/Comment Code/Block comment at first column: Uncheck

  • Editor/Code Style/[Language]/Code Generation/Comment Code/Add a space at comment start: Check

Clone this wiki locally