Set up black formatter
Add black formatter and a corresponding pre-commit hook.
Issue: HIC-161
Change-Id: I8aed563114a6350cc5803f0c5232d3a20d6d6eb6
diff --git a/tox.ini b/tox.ini
index b0b15d2..650641f 100644
--- a/tox.ini
+++ b/tox.ini
@@ -4,7 +4,7 @@
# and then run "tox" from this directory.
[tox]
-envlist = py35
+envlist = py36
# There is no proper way to install the app for now (i.e. setup.py)
skipsdist = True
@@ -37,6 +37,15 @@
{[testenv:flake8]commands}
{[testenv:pylint]commands}
+# Git pre-commit hooks: Run formatter and linters
+[testenv:pre-commit-hooks]
+deps =
+ -rrequirements-dev.txt
+passenv = GIT_INDEX_FILE
+commands =
+ {toxinidir}/tools/hooks/pre-commit.d/pre-commit-black.sh
+ python {toxinidir}/tools/hooks/pre-commit.d/pre-commit-flake8.py
+
# Flake8 configuration
[flake8]
format = ${cyan}%(path)s${reset}:${yellow_bold}%(row)d${reset}:${green_bold}%(col)d${reset}: ${red_bold}%(code)s${reset} %(text)s