dcbdd590d4b2 draft — Oben Sonne 4 years ago
add flak8 style checking
1 files changed, 19 insertions(+), 1 deletions(-)

M Makefile
M Makefile +19 -1
@@ 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
 # =============================================================================