Skip to content

Files

Latest commit

author
Aurora Wang
Nov 9, 2018
80be8d2 · Nov 9, 2018

History

History
77 lines (60 loc) · 2.53 KB

CONTRIBUTING.md

File metadata and controls

77 lines (60 loc) · 2.53 KB

Contributing guidelines

Want to contribute? Awesome!

Contribution steps

  1. First and foremost: adhere to our Code of Conduct;
  2. Fork it (https://github.com/instruct-br/grua/fork);
  3. Create your feature branch (git checkout -b feature/fooBar);
  4. Commit your changes with an informative message (git commit);
  5. Push to the branch (git push origin feature/fooBar);
  6. Create a new Pull Request following the project's pull request template (available on Github interface).

Development environment (with Docker)

GRUA has a docker-compose.dev.yml file specifically created to help the development process. It is responsible to mount volumes on Docker so the changes you made on the code are reflected on the containers.

Build the containers with:

docker-compose -f docker-compose.yml -f docker-compose.dev.yml build

Apply database migrations with:

docker-compose run webapp python manage.py migrate

Create a generic admin user:

docker-compose run webapp python manage.py shell -c "from django.contrib.auth.models import User; User.objects.create_superuser('admin', 'admin@example.com', 'admin')"

Spin up the containers with:

docker-compose -f docker-compose.yml -f docker-compose.dev.yml up

Frontend static assets are mapped with local files in the development containers. To generate assets locally you need to install JS dependencies: npm 6.4.1 and node v8.12.0. These assets can be created with:

cd webapp/
npm install
npm run build
cd ..

Style guide

We mostly use PEP8 as our style guide (aside of us allowing bigger line lengths).

You can use Black to format your code (while the containers are up):

docker exec -it grua_webapp_1 black .

And Flake8 to check it (while the containers are up):

docker exec -it grua_webapp_1  pipenv run flake8 --exclude=*/migrations/* --exclude node_modules/ --ignore=E501 .

Tests

We also encourage developers to implement tests when contributing to a new feature or a bug fix. It is possible to run tests with:

docker-compose -f docker-compose.yml -f docker-compose.dev.yml run webapp python manage.py test