Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(linting): adds instructions for flake8 #170

Merged
merged 3 commits into from
Oct 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 32 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Team Production System is an app for mentees to schedule one-on-one sessions wit
- [Run Locally via Docker Containers](#run-locally-via-docker-containers)
- [Environment Variables](#environment-variables)
- [Testing](#testing)
- [Linting](#linting)
- [Submitting Code](#submitting-code)
- [API Reference](#api-reference)

Expand Down Expand Up @@ -103,22 +104,26 @@ celery -A config.celery beat -l debug
You will also need to have your .env file set up.

Update `requirements.txt` with any newly added installs:

```bash
pipenv requirements > requirements.txt
```

**Note:** If this step deletes everything in the requirements.txt file, your pipenv is out of date.
You can update it with the following command:

```bash
pip install --user --upgrade pipenv
```

Build docker images:

```bash
docker compose build
```

Spin up docker containers:

```bash
docker compose up
```
Expand All @@ -130,18 +135,19 @@ Use the DJANGO_SUPERUSER credentials you set in the .env file.

If you want to connect to the container database via an app like Postico 2, the settings needed are:

- Host: localhost
- Port: 5433
- Database: mentors
- User: mentors
- Password: mentors
- Host: localhost
- Port: 5433
- Database: mentors
- User: mentors
- Password: mentors

While running, the Django server will automatically detect changes made and
reload, just as if it was running in your local environment.
Certain file changes, such as to a model, won't trigger this behavior.
In these cases, stop then restart the containers.

To stop running the containers, hit Ctrl+C, then spin down the containers:

```bash
docker compose down
```
Expand All @@ -151,13 +157,18 @@ before resetting the the database.
Follow these 2 steps once the containers are no longer running:

- Remove the persistant volume:

```bash
docker volume rm team_production_system_be_postgres_data
```
```

- Rebuild the docker images:

````
- Rebuild the docker images without the cached data:
```bash
docker compose build --no-cache
```
````

The next time you spin up the docker containers, the database will be empty again.

Expand Down Expand Up @@ -225,6 +236,16 @@ Then in the `htmlcov` folder of the project, open the file `index.html` in a bro

Here is some helpful information on testing in Django and Django REST Framework: https://www.rootstrap.com/blog/testing-in-django-django-rest-basics-useful-tools-good-practices

# Linting

To keep our code easy to read and use please make sure it passes flake8 linting before submitting your code. To run in terminal:

```bash
flake8
```

Each error will show the file name and line to find the error. The command can be run over and over again until errors are cleared.

# Submitting Code

We use a pre-commit to check branch names and commit messages. Please follow the the following schema for branch names and commit messages:
Expand Down Expand Up @@ -604,7 +625,7 @@ Host: https://team-production-system.onrender.com
POST - https://team-production-system.onrender.com/mentorinfo/
```

| Body | Type | Description |
| Body | Type | Description |
| :------------ | :------- | :------------------------- |
| `pk` | `int` | The mentor pk |
| `about_me` | `string` | Information about the user |
Expand Down Expand Up @@ -661,8 +682,8 @@ GET - https://team-production-system.onrender.com/mentorinfo/
| Body | Type | Description |
| :------------ | :------- | :------------------------- |
| `pk` | `int` | The mentor pk |
| `about_me` | `string` | Information about the user |
| `skills` | `string` | Skills the user has |
| `about_me` | `string` | Information about the user |
| `skills` | `string` | Skills the user has |
| `team_number` | `int` | Mentor's team number |

**Nested Information:**
Expand Down Expand Up @@ -717,7 +738,7 @@ Host: https://team-production-system.onrender.com
PATCH - https://team-production-system.onrender.com/mentorinfoupdate/
```

| Body | Type | Description |
| Body | Type | Description |
| :------------ | :------- | :------------------------- |
| `pk` | `int` | The mentor pk |
| `about_me` | `string` | Information about the user |
Expand Down