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

Use Pre-commit #743

Merged
merged 5 commits into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
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
15 changes: 8 additions & 7 deletions docs/contribution.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,16 @@ We welcome contributions! If you have an idea for a new module, or are a Python

```bash
# clone your forked repo and cd into it
git clone [email protected]/<username>/bbot.git && cd bbot
git clone [email protected]/<username>/bbot.git
cd bbot

# install poetry
curl -sSL https://install.python-poetry.org | python3 -

# install pip dependencies
poetry install
# install pre-commit hooks, etc.
poetry run pre-commit install

# enter virtual environment
poetry shell
Expand All @@ -28,12 +31,7 @@ bbot --help
```

- Now, any changes you make in the code will be reflected in the `bbot` command.
- Run the tests locally to ensure they pass.
- Finally, commit and push your changes, and create a pull request to the `dev` branch of the main BBOT repo.

## Running Tests

BBOT makes use of pytest for its unit testing. You can run the tests simply by executing the bash script at `bbot/test/run_tests.sh`:
- After making your changes, run the tests locally to ensure they pass.

```bash
# auto-format code indentation, etc.
Expand All @@ -43,6 +41,9 @@ black .
./bbot/test/run_tests.sh
```

- Finally, commit and push your changes, and create a pull request to the `dev` branch of the main BBOT repo.


## Creating a Module

Writing a module is easy and requires only a basic understanding of Python. It consists of a few steps:
Expand Down
169 changes: 127 additions & 42 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ pytest-env = "^0.8.2"
pytest-httpx = "^0.22.0"
pytest-timeout = "^2.1.0"
pytest = "^7.4.0"
pre-commit = "^3.4.0"

[tool.pytest.ini_options]
env = [
Expand Down