-
Notifications
You must be signed in to change notification settings - Fork 36
Development Guidelines
Steve Hillier edited this page Mar 22, 2018
·
6 revisions
To ensure that future additions to the code base are continuously improving the overall code quality, please follow these guidelines:
- Follow PEP-8 Style Guide for basic guidelines on style and organization. This includes using 4 spaces instead of tabs for indents, using upper case for class names (e.g.
MyClassName()
), and using lower case with underscores for functions and variables (e.g.my_function_name()
andmy_variable_name
). - Enable PEP-8 linting in your IDE.
- Further suggestions:
- PEP-8 suggests a 79 character line limit, but that is difficult to work within. GitHub can display up to 110-120 characters per line for reviewing changes (depending on browser), so please wrap long lines before reaching this length.
- In general, follow conventions in Django's official documentation or Two Scoops of Django 1.11 (a copy available in lab)
- Project-specific guidelines (common things that might come up working on GWELLS):
- Model fields: blank=True, null=True - do not set both at once. Please set blank=True for CharFields instead of null=True.
-
Model ForeignKey relationship: on_delete - in general, use
models.SET_NULL
unless the table absolutely depends on the parent's existence.
- 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.
- The Vue community tends to use the "Standard" style guide. Some of the most obvious differences between Standard and AirBNB are no semi-colons, and a space between function names and parentheses - e.g.,
function () { ... }
. Runningnpm install
in thefrontend
folder will automatically install a linter with Standard rules. - Use single file components when it makes sense. For example, a modal that can be re-used on other pages, or clearly separated sections of a single page (header, footer etc).
- Run tests with
npm run test
ornpm 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
).
- Working on GWELLS (full workflow from writing code to deploying to prod)
- Water terminologies
- Testing
- Swagger Documentation
- Restore a database backup manually
- (Archived) Manual Syncing of DEV to TEST to PROD
- (Archived) Setup GWells data migration for local dev test
- Update PostGres Oracle Foreign Data Wrapper image
- Increase PostgreSQL Database storage
- (Archived) Regular Corruption of the PostgreSQL DB
- (Archived) Recovering from a corrupt PostgreSQL Database