Skip to content

Commit

Permalink
Merge pull request #743 from blacklanternsecurity/pre-commit
Browse files Browse the repository at this point in the history
Use Pre-commit
  • Loading branch information
TheTechromancer authored Sep 19, 2023
2 parents c87a5a5 + 0640bce commit 6e17307
Show file tree
Hide file tree
Showing 3 changed files with 136 additions and 49 deletions.
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

0 comments on commit 6e17307

Please sign in to comment.