Skip to content
This repository has been archived by the owner on Feb 25, 2022. It is now read-only.

Code style guide

mwobensmith edited this page Dec 18, 2018 · 5 revisions

Iris follows fairly standard conventions with regard to code. The most obvious is the PEP 8 standard for Python. While we do not obey every PEP 8 rule, in general, they are good practice. Use the PEP 8 inspector in your IDE or similar to find problems.

Some of our standards include:

  • PEP 8 for Python files
    • Whitespace - spaces and line returns
    • Comment formatting - single-line and multiline
    • Variable, function, and class naming
    • Single quotes for function arguments
    • Import statements
      • Order
      • Avoid wildcards when possible
      • Delete when unused
  • Comments
    • Use hash comments when documenting internal-only functions
    • Use triple-quote comments when documenting external functions, intended to be part of the API
  • Python file names
    • Lowercase
    • Underscores in place of spaces
    • Contain no other alphanumeric characters (aside from file extension)
  • Image file names
  • JavaScript, bash, and other file types
    • TBD

Other conventions:

  • Code files are terminated with a line return
  • Comments are full sentences that begin with a capitalized word and end with a period
  • Error messages are also full sentences, as above
  • URLs must include protocol
  • Proper spelling, grammar, and punctuation are enforced