Skip to content

Instantly share code, notes, and snippets.

@shaunagm
Last active November 27, 2018 16:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shaunagm/04185290a783c71fc798622847389afb to your computer and use it in GitHub Desktop.
Save shaunagm/04185290a783c71fc798622847389afb to your computer and use it in GitHub Desktop.
Code Checklist

All code should:

Tests

  • unit tests covering all functionality
  • integration tests where necessary

Documentation

  • docstrings on every class, and every method > 2 lines long
  • describe behavior in docs repo if necessary
  • ops/configuration changes documented in project wiki

Hygiene

  • pylint passes
  • mypy type-checking passes
  • version control commits are sensible
  • names are pythonic and descriptive
  • new dependencies added to requirements.txt
  • single vs double quoted strings used consistently

Method checks

  • all methods use keyword params
  • all methods are small as possible
  • all methods are private unless explicitly needed to be otherwise
  • all methods check preconditions at beginning of method and raise errors (if needed)
  • all method calls can handle anything the method call returns (even if it's just to silently drop it)
  • all method calls across boundaries have a timeout and can handle no or bad responses

Check for appropriate use:

  • descriptors: are there places you could use these, but haven't?
  • partials: are there places you could use these, but haven't?
  • data structures: are you using the optimal data structure?
  • try/except statements: are you using try/except to control flow? maybe... don't?
  • try/except statements: exception caught is as specific as possible
  • database calls: does the code handle getting no results? what about way too many results? be careful with .all() queries and anything without limits (note that most ORMs do not allow you to set limits on associations/relationships)

Special instructions for this project

  • are all references between apps made via client?
  • are all state changes made in a method of a subclass of BaseStateChange?
  • are all new models a subclass of PermissionedModel? if not, why not?
  • if new models are created, do their data fields serialize correctly?
  • are Django custom fields used appropriately?

Things to consider adding, need to research more

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment