diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..1f6e40f --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,10 @@ +repos: + - repo: https://github.com/pycqa/flake8 + rev: 6.0.0 + hooks: + - id: flake8 + args: + - --count + - --max-complexity=10 + - --max-line-length=127 + - --statistics diff --git a/README.md b/README.md index a47ffea..7848b7b 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,17 @@ To test the package, you can use the following command: pytest ``` +To enable style checks before every commit, install the development dependencies and +set up the git pre-commit hook: + +```bash +pip install -r requirements-dev.txt +pre-commit install +``` + +Then pre-commit will run `flake8` as a check-only step. It reports failures and +does not automatically rewrite files. + ## How can I contact you? You can open a new discussion in this repository's [Discussion](https://github.com/alifa98/GameKit/discussions) section for any question. diff --git a/requirements-dev.txt b/requirements-dev.txt index 50d197e..e41f6b7 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,4 +1,5 @@ build==0.10.0 flake8==6.0.0 +pre-commit==3.8.0 pytest==7.4.0 twine==4.0.2