Skip to content

Latest commit

 

History

History
80 lines (47 loc) · 3.23 KB

CONTRIBUTING.md

File metadata and controls

80 lines (47 loc) · 3.23 KB

Contributing

Bug reports, feature requests and pull requests are welcome but please bear in mind that there may be some delay before I have time to respond to these.

If planning a pull request you may wish to open an issue first to discuss your modifications. Please try to stick to the guidelines below. There are also instructions on setting up a development environment.

Tools

The following tools are used in this project:

Server-side

With the exception of importing OpenStreetMap data and producing statistics/graphs, the backend is written in Python.

Client-side

The frontend is written in JavaScript (ES6).

Development

Python

JavaScript

Coding style

Python

  • Please follow PEP 8 and use pylint to check your code e.g. using docker-compose run python scripts/run_pylint.sh
  • Please use double quotes (") for strings
  • Feel free to break up sections of code with a blank line
  • Please put two blank lines between class and method definitions

JavaScript

  • Please follow the Airbnb style guide with the modifications configured in package.json and use eslint to check your code e.g. using docker-compose run node npm run lint
  • Please use double quotes (") for strings

Line length

  • Code lines should be 79 characters or less, unless they contain a URL or finish with a coverage/pylint/eslint comment
  • Python docstring lines should be 72 characters or less

Imports

  • Please separate Python standard library, third-party and local imports with a line break, and within each block import in alphabetical order of package
  • In Python code, in general please use the from x import y style

Unit tests

These are a work in progress but please do write unit tests for any new code (apart from that which downloads external data) and check coverage.

Python

  • You can find unit tests in tests/ with a file per class per module
  • docker-compose run python scripts/run_tests.sh will run the tests and provide a coverage report in coverage/python

JavaScript

  • You can find unit tests in fhodot/app/ui/src
  • docker-compose run node npm run test will run the tests in Chromium Headless using Karma and provide a coverage report in coverage/javascript
  • Tests can also be run in a browser (http://127.0.0.1:5000/tests.html) once bundled with docker-compose up node or docker-compose run node npm run build