-
Notifications
You must be signed in to change notification settings - Fork 0
Coding Standards
Much of our code is written in Python, for which there is a standard style guide. This style guide is the authoritative source of style information for our Python code, except where noted below.
In general, use variables that are appropriate length and to the point. Avoid abbreviation and acronyms, except extremely common ones such as "WWW".
For Python, use PEP8 naming conventions. Specific examples: module_name, package_name, ClassName, method_name, ExceptionName, function_name, GLOBAL_CONSTANT_NAME, global_var_name, instance_var_name, function_parameter_name, local_var_name.
All CSS names must be lower-case, words separated by hyphens. Example: "error-message"
Names to avoid:
- single character names except for counters or iterators
- dashes (-) in any package/module name
- _double_leading_and_trailing_underscore_ names
Not applicable to Python.
For CSS, the opening brace is preceded by a space but not a newline, and the ending brace must be have the same indent level as the scope's identifier. For example:
.error-message {
//contents
}
See Class Member order.
- "Constants" and public variables
- Public API
- Internal/"private" functions, main functions (see http://docs.python.org/2/tutorial/classes.html#private-variables-and-class-local-references)
In Python, indent code blocks with 4 spaces, in accordance with the PEP 8 standard. In CSS and HTML, indent with tabs.
For Python, see http://www.python.org/dev/peps/pep-0008/#id20, excepting the rule regarding two spaces after a period.
Use comments in CSS sparingly.
The programmer is encouraged to provide URL references to any code blocks, routines, or algorithms copied or adapted from an online source such as Stack Overflow.