Install the dependency manager (if not already done):
pip3 install poetry
Install all dependencies, pre-commit hooks, and git config:
poetry install
pre-commit install
git config commit.template .gitmessage
and you should be ready to go!
❯ poetry run tryceratops --version
tryceratops, version 2.4.1
You can either run:
❯ poetry run pytest
================================================ test session starts ================================================
platform darwin -- Python 3.9.5, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
rootdir: /Users/guilhermelatrova/guilatrova/tryceratops
collected 16 items
src/tests/analyzers_test.py ......... [ 56%]
src/tests/files_test.py ....... [100%]
================================================ 16 passed in 0.09s =================================================
or test it against some violation files we have in place:
❯ poetry run tryceratops src/tests/samples/violations/call_too_many_try.py
[TRY101] Too many try blocks in your function - src/tests/samples/violations/call_too_many_try.py:15:4
[TRY101] Too many try blocks in your function - src/tests/samples/violations/call_too_many_try.py:27:4
[TRY101] Too many try blocks in your function - src/tests/samples/violations/call_too_many_try.py:32:4
Done processing! 🦖✨
Processed 1 files
Found 3 violations
You can try it with flake8 if preferred:
❯ poetry run flake8 --select TRY src/tests/samples/violations/call_too_many_try.py
src/tests/samples/violations/call_too_many_try.py:15:5: TRY101 Too many try blocks in your function
src/tests/samples/violations/call_too_many_try.py:27:5: TRY101 Too many try blocks in your function
src/tests/samples/violations/call_too_many_try.py:32:5: TRY101 Too many try blocks in your function
If you installed pre-commit
it should ensure you're not commiting anything broken.
You can run ./bin/lint
to fix some issues for you.
We automate the versioning and release process! It's only possible if we are consistent with the commit pattern and follow the conventional commits standards.
Refer to Conventional Commits here and if you're curious to understand how the publishing works check here.