From f0af94aa41e82626b4b97460b4edc841c825654d Mon Sep 17 00:00:00 2001 From: Paul Harrison Date: Fri, 18 Nov 2022 13:24:52 +0000 Subject: [PATCH] chore: Add helpful make commands and run linting --- Makefile | 74 +++++++++++++++++++++++++++++++++++++++++++++ poker/constants.py | 3 -- pyproject.toml | 2 +- tests/test_poker.py | 1 - 4 files changed, 75 insertions(+), 5 deletions(-) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..580d167 --- /dev/null +++ b/Makefile @@ -0,0 +1,74 @@ +.DEFAULT_GOAL := help +SHELL := /bin/bash + +.PHONY: black +black: ## Run black formatter + @poetry run black poker tests; + +.PHONY: black-check +black-check: ## Run black formatter + @poetry run black poker tests --check; + +.PHONY: clean +clean: ## Remove python cache files + -@find . -name '*.pyc' -exec rm -f {} +; + -@find . -name '*.pyo' -exec rm -f {} +; + -@find . -name '*__pycache__' -exec rm -fr {} +; + -@find . -name '*.mypy_cache' -exec rm -fr {} +; + -@find . -name '*.pytest_cache' -exec rm -fr {} +; + -@find . -name '*.coverage' -exec rm -fr {} +; + +.PHONY: flake8 +flake8: ## Run flake8 linting + @poetry run flake8 poker tests --config=setup.cfg; + +.PHONY: force-update +force-update: ## Forcefully update poetry.lock using pyproject.toml + -@rm poetry.lock; + @poetry update; + +.PHONY: format +format: isort black ## Format to match linting requirements + +.PHONY: help +help: ## Show all available commands + @awk 'BEGIN {FS = ":.*##"; printf "Usage: make \033[36m\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-13s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST); + +.PHONY: install +install: ## Install all packages using poetry.lock + @poetry install --no-interaction; + +.PHONY: install-prod +install-prod: ## Install all production packages using poetry.lock + @poetry install --no-interaction --only main; + +.PHONY: isort +isort: ## Run isort formatter + @poetry run isort poker tests --settings-path=setup.cfg; + +.PHONY: isort-check +isort-check: ## Run isort formatter + @poetry run isort poker tests --settings-path=setup.cfg --check-only; + +.PHONY: mypy +mypy: ## Run mypy type checking + @poetry run mypy --config-file=setup.cfg poker tests; + +.PHONY: pydocstyle +pydocstyle: ## Run docstring linting + @poetry run pydocstyle poker tests --config=setup.cfg; + +.PHONY: quality +quality: flake8 mypy isort-check black-check pydocstyle ## Run linting checks + +.PHONY: test +test: ## Run test pipeline + @poetry run pytest -c=setup.cfg -x + +.PHONY: uninstall +uninstall: ## Remove virtual environment + @-rm -rf `poetry env info -p`; + +.PHONY: update +update: ## Update poetry.lock using pyproject.toml + @poetry update; \ No newline at end of file diff --git a/poker/constants.py b/poker/constants.py index 3eeebff..b47fb1e 100644 --- a/poker/constants.py +++ b/poker/constants.py @@ -28,6 +28,3 @@ class Value(IntEnum): JACK = 11 QUEEN = 12 KING = 13 - - - diff --git a/pyproject.toml b/pyproject.toml index 7308ae2..891167c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "poker" -version = "0.2.2" +version = "0.2.3" description = "Single poker hand ranking service." authors = ["Paul Harrison"] readme = "README.md" diff --git a/tests/test_poker.py b/tests/test_poker.py index fd04676..eb1cb52 100644 --- a/tests/test_poker.py +++ b/tests/test_poker.py @@ -1,4 +1,3 @@ def test_poker() -> None: """Dummy test.""" assert True -