Coding Style - abrt/faf GitHub Wiki

  • Follow PEP 8
  • All code should be Python 3 compliant
  • Use 4 spaces for indentation, do not use tabs
  • Only import what you really need
  • Limit lines to 79 characters (it's in PEP 8 :)); the only exceptions are pyfaf.storage objects - keep it one attribute per line
  • Use if x is None: and if x is not None: rather than if x:, if not x: or if not x is None:
  • Use FafError or its subclass when raising an exception related to faf.
  • For strings, use double quotes rather than single quotes - "string" rather than 'string'.
  • Use __all__ for exporting functions and constants from modules.
  • Use docstrings for all functions, exported methods and constants.
  • Executables should be minimal. Most of the code should be present in core module so it's possible to test and reuse it easily.

Comment style

  • Follow PEP 257
  • Use double quotes.
  • One empty line after comment.
  • Comments should start on empty line for better readability.

Comments with argument/return value/exceptions specification: Either http://sphinx-doc.org/domains.html#info-field-lists or style used by google http://pythonhosted.org/an_example_pypi_project/sphinx.html#full-code-example