This repository has been archived by the owner on Feb 25, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Code Conventions
Oscar S edited this page Apr 8, 2019
·
3 revisions
This document covers the code conventions that should be observed when making changes to the VisualGit codebase.
If there is any doubt as to whether code is conformant with the conventions, you should run the linter to check. The use of the linter is documented in Section 2.1.6.
- To ensure the readability of the code, lines should be under 140 characters.
- Semicolons should be used at the end of lines. While JavaScript allows the omission of semicolons (via 'automatic semicolon insertion'), it can cause bugs.
- Open braces should be on the same line as the expression that precedes them, like:
if (x) {
//...
}
and not:
if (x)
{
//...
}
This rule is to ensure stylistic consistency.
- Indentation should be using 2 spaces.
- Strings should be single-quoted, like:
let x = "hello, world!";
- Use of the
new
operator should use parens like:new Car()
to maintain stylistic consistency with function calls. - Bitwise operators should not be used. Mostly, the use of these operators is a mistake, e.g.
if (x & y)
, or is a symptom of overly-clever, unmaintainable code. - Assignment in conditionals like
if (x = y)
is not allowed. This is because usually this is not what programmers intend to write, and is the source of bugs. -
for (... of ...)
loops are preferred.
Copyright © Team Project Hype-r Phlame. 2019. All Rights Reserved.