# HG changeset patch # User Oben Sonne # Date 1519571912 -3600 # Sun Feb 25 16:18:32 2018 +0100 # Node ID dcbdd590d4b2532e5cc6569f2dbb5cc4b9510a98 # Parent 35b2a02ff623b079c122424021c7cb3b99adb06d add flak8 style checking diff --git a/Makefile b/Makefile --- a/Makefile +++ b/Makefile @@ -95,7 +95,14 @@ endef export HGIGNORE +define HGRC +[hooks] +pre-commit=make style +endef +export HGRC + define REQUIREMENTS +flake8 isort nose endef @@ -104,6 +111,9 @@ .hgignore: @echo "$$HGIGNORE" > $@ +.hg/hgrc: + @echo "$$HGRC" > $@ + setup.py: @echo "$$SETUP" > $@ @@ -119,7 +129,7 @@ touch $@/tests/cli_tests.py .PHONY: init -init: | .hgignore requirements.txt setup.py src/$(APP) +init: | .hgignore requirements.txt setup.py src/$(APP) .hg/hgrc .PHONY: initclean initclean: @@ -153,6 +163,14 @@ env/bin/isort --line-width 80 --order-by-type -m 5 $$file; \ done +.PHONY: style +style: ## perform style checks +style: + @for file in `hg st -nam | grep '\.py'`; do \ + echo "check $$file"; \ + env/bin/flake8 $$file; \ + done + # ============================================================================= # tests # =============================================================================