Skip to content

Commit

Permalink
chore(skip): added pre-commit hook configuration and CONTRIBUTING gui…
Browse files Browse the repository at this point in the history
…delines

Signed-off-by: Paul Horton <paul.horton@owasp.org>
  • Loading branch information
madpah committed Apr 3, 2024
1 parent e32294c commit ab76c02
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
fail_fast: true
repos:
- repo: local
hooks:
- id: system
name: mypy
entry: poetry run tox -e mypy-locked
pass_filenames: false
language: system
- repo: local
hooks:
- id: system
name: isort
entry: poetry run isort -c .
pass_filenames: false
language: system
- repo: local
hooks:
- id: system
name: flake8
entry: poetry run flake8 requirements/ tests/
pass_filenames: false
language: system
78 changes: 78 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Contributing

Pull requests are welcome, but please ensure they are supported by at least 1 open Issue ticket describing
the objectives of the PR.

## Setup

This project uses [poetry]. Have it installed and setup first.

To install dev-dependencies and tools:

```shell
poetry install
```

## Code style

This project uses [PEP8] Style Guide for Python Code.
This project loves sorted imports.
Get it all applied via:

```shell
poetry run isort .
poetry run autopep8 -ir requirements/ tests/
```

This project prefers `f'strings'` over `'string'.format()`.
This project prefers `'single quotes'` over `"double quotes"`.
This project prefers `lower_snake_case` variable names.

## Documentation

This project uses [Sphinx] to generate documentation which is automatically published to [readthedocs.io].

Source for documentation is stored in the `docs` folder in [RST] format.

You can generate the documentation locally by running:

```shell
cd docs
pip install -r requirements.txt
make html
```

## Testing

Run all tests in dedicated environments, via:

```shell
poetry run tox run
```

## Sign off your commits

Please sign off your commits, to show that you agree to publish your changes under the current terms and licenses of the project
, and to indicate agreement with [Developer Certificate of Origin (DCO)](https://developercertificate.org/).

```shell
git commit --signed-off ...
```

## Pre-commit hooks

If you like to take advantage of [pre-commit hooks], you can do so to cover most of the topics on this page when
contributing.

```shell
pre-commit install
```

All our pre-commit checks will run locally before you can commit!

[poetry]: https://python-poetry.org
[PEP8]: https://www.python.org/dev/peps/pep-0008
[Sphinx]: https://www.sphinx-doc.org/
[readthedocs.io]: https://requirements-parser.readthedocs.io/
[RST]: https://en.wikipedia.org/wiki/ReStructuredText
[pre-commit hooks]: https://pre-commit.com
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ upload_to_vcs_release = true
changelog_file = "CHANGELOG.md"
exclude_commit_patterns = [
"chore\\(release\\):",
"chore\\(skip\\):",
]

[tool.semantic_release.branches.main]
Expand Down

0 comments on commit ab76c02

Please sign in to comment.