Skip to content

Development Guidelines

Steve Hillier edited this page Apr 6, 2018 · 6 revisions

GWELLS Development Guidelines

To ensure that future additions to the code base are continuously improving the overall code quality, please follow these guidelines:

Python

  • Follow PEP-8 Style Guide for basic guidelines on style and organization.
  • Use 4 spaces instead of tabs for indents
  • Enable PEP-8 linting in your IDE.
  • PEP-8 suggests a 79 character line limit, but that is not always practical. Please wrap long lines before 110 characters (approximate limit for viewing changes on GitHub).

Django

  • Follow conventions in Django's official documentation or Two Scoops of Django 1.11 (a copy available in lab)
  • Model ForeignKey relationship: on_delete - in general, use models.PROTECT.

Django unit tests

  • Tests: to run Django tests, use python manage.py test -c nose.cfg. When submitting any new code or features, please include unit tests in your pull request.

Vue / JavaScript

  • npm install will install ESLint with the "Standard" style guide set of linting rules. We use "Standard" because Vue documentation tends to use this style.

Vue unit tests

  • Run tests with npm run test or npm run watch (auto-watch files and run tests on files that you change)
  • Vue unit tests use Jest and vue-test-utils. Refer to the current tests or the documentation for each for guidance on writing more.
  • The general workflow for writing a test is to shallow render a component (render one component and its immediate child components only), then search for the tag or id's in the HTML (wrapper.find("p")) or inspect the Vue instance data (wrapper.vm.myVariable).
Clone this wiki locally