@@ 95,7 95,14 @@ bin
endef
export HGIGNORE
+define HGRC
+[hooks]
+pre-commit=make style
+endef
+export HGRC
+
define REQUIREMENTS
+flake8
isort
nose
endef
@@ 104,6 111,9 @@ export REQUIREMENTS
.hgignore:
@echo "$$HGIGNORE" > $@
+.hg/hgrc:
+ @echo "$$HGRC" > $@
+
setup.py:
@echo "$$SETUP" > $@
@@ 119,7 129,7 @@ src/$(APP):
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 @@ isort:
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
# =============================================================================