Set up pre-commit hook and related make targets.
This commit is contained in:
parent
9050b7948b
commit
637650245e
1 changed files with 16 additions and 3 deletions
19
Makefile
19
Makefile
|
@ -2,13 +2,15 @@
|
||||||
help: ## List make targets
|
help: ## List make targets
|
||||||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
|
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
|
||||||
|
|
||||||
lint: ## Lint source code
|
.PHONY: format
|
||||||
poetry run flake8
|
|
||||||
|
|
||||||
format: ## Format source code
|
format: ## Format source code
|
||||||
poetry run isort .
|
poetry run isort .
|
||||||
poetry run black .
|
poetry run black .
|
||||||
|
|
||||||
|
.PHONY: lint
|
||||||
|
lint: ## Lint source code
|
||||||
|
poetry run flake8
|
||||||
|
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
test: ## Run non-live tests
|
test: ## Run non-live tests
|
||||||
poetry run pytest -m "not live" --color=yes
|
poetry run pytest -m "not live" --color=yes
|
||||||
|
@ -22,3 +24,14 @@ coverage: ## Generate and open coverage report
|
||||||
poetry run coverage run --source=pricehist -m pytest
|
poetry run coverage run --source=pricehist -m pytest
|
||||||
poetry run coverage html
|
poetry run coverage html
|
||||||
xdg-open htmlcov/index.html
|
xdg-open htmlcov/index.html
|
||||||
|
|
||||||
|
.PHONY: install-pre-commit-hook
|
||||||
|
install-pre-commit-hook: ## Install the git pre-commit hook
|
||||||
|
echo -e "#!/bin/bash\nmake pre-commit" > .git/hooks/pre-commit
|
||||||
|
chmod +x .git/hooks/pre-commit
|
||||||
|
|
||||||
|
.PHONY: pre-commit
|
||||||
|
pre-commit: ## Checks to run before each commit
|
||||||
|
poetry run isort src tests --check
|
||||||
|
poetry run black src tests --check
|
||||||
|
poetry run flake8
|
||||||
|
|
Loading…
Add table
Reference in a new issue