api-guidelines

Code Style

The most important thing when working on a team is communication. People need to be able to work together effectively and the only way to do that is by communicating. As developers, we communicate primarily through code. We communicate with other parts of the software through code and we communicate with other developers through code.

Always remember: “Programs are meant to be read by humans and only incidentally for computers to execute.”

Java

We use the Google Java Code Style with line wrap set to 120 columns (our monitors are big!)

Eclipse

How to import XMLs:

Eclipse -> Preferences -> Java -> Code Style -> Code Templates/Formatter

Note: If you want to generate the comments automatically, you can toggle on Option Automatically add comments for new methods and types under Code Templates tab.

Intellij IDEA

How to import the Jar:

File -> Import Settings   Select `java/intellij/java-code-style-v1.jar`

Then, you will be guide to restart the Intellij IDE. All set!

JavaScript

We use airbnb guidelines. Specially 2 spaces indentation.

Python

We follow the PEP8 style guide for Python with a few modifications like 4 spaces – never tabs – for indentation.
This is a strict rule and ignoring this can (has) cause(d) bugs.

pylint will help you check that you are not breaking the rules.
We have some checks that are disable like 80 characters max for line length.

pylint . --disable=F0401,E0611,E1124,E1004,C0111,I0011,I0012,W0704,W0142,W0212,W0232,W0613,W0702,R0201,W0614,R0914,R0912,R0915,R0913,R0903,R0904,R0801,C0301

Docstrings

All non-trivial methods should have docstrings. Docstrings should follow guidelines here: PEP257. For more examples, see the Google style guide around docstrings.

Swift

Based on The Official raywenderlich.com Swift Style Guide and Swift API Design Guidelines, with exceptions/additions as follows:

let emptyArray = [String]()
let emptyDictionary = [String: Float]()

Swiftlint

SwiftLint is a tool to enforce Swift coding style and conventions.

You can use SwiftLint with a special configuration file to enforce this coding style.

You can find an example SwiftLint configuration file that essentially conforms to the above coding style conventions here.