[tox]
minversion = 1.6
-envlist = coala,docs
+envlist = pre-commit,gitlint,docs,docs-linkcheck,spelling
skipsdist = true
-[testenv:coala]
+[testenv:docs]
basepython = python3
-deps =
- coala==0.11
- coala-bears==0.11
- # Requests 2.16 breaks coala dependency on chardet
- requests<2.16
- nodeenv
+deps = -rdocs/requirements.txt
commands =
- nodeenv -p
- npm install --global remark-cli remark-lint
- coala --non-interactive
+ sphinx-build -q -j auto -W -b html -n -d {envtmpdir}/doctrees ./docs/ {toxinidir}/docs/_build/html
-[testenv:docs]
-deps = -rrequirements.txt
+[testenv:docs-linkcheck]
+basepython = python3
+deps = -rdocs/requirements.txt
+commands = sphinx-build -q -b linkcheck -d {envtmpdir}/doctrees ./docs/ {toxinidir}/docs/_build/linkcheck
+
+[testenv:pre-commit-install]
+basepython = python3
+deps = pre-commit
commands =
- sphinx-build -j 4 -b html -n -d {envtmpdir}/doctrees ./docs/ {toxinidir}/docs/_build/html
- echo "Generated docs available in {toxinidir}/docs/_build/html"
-whitelist_externals = echo
+ pre-commit install
+ pre-commit install --hook-type commit-msg
+
+[testenv:pre-commit-uninstall]
+basepython = python3
+deps = pre-commit
+commands =
+ pre-commit uninstall
+ pre-commit uninstall --hook-type commit-msg
+
+[testenv:pre-commit]
+basepython = python3
+deps = pre-commit
+passenv = HOME
+commands =
+ pre-commit run --all-files --show-diff-on-failure
+ pre-commit run gitlint --hook-stage commit-msg --commit-msg-filename .git/COMMIT_EDITMSG
+ # Gitlint only proposes a pre-commit configuration for the commit-msg stage but none for the commit stage.
+ # Its default arguments --passed and --msg-filename are different from CI recommandations.
+ # As a result, the line above is skipped in jenkins CI since there cannot be a .git/COMMIT_EDITMSG file
+ # and the HOME variable must be passed to tox virtualenv so that Gitlint can access the git user configuration.
+ # A dedicated gitlint profile for CI is proposed below.
+
+[testenv:gitlint]
+basepython = python3
+deps = gitlint
+commands =
+ gitlint
+
+[testenv:spelling]
+basepython = python3
+deps =
+ -rdocs/requirements.txt
+ sphinxcontrib-spelling
+ PyEnchant
+whitelist_externals = sh
+commands =
+ sh -c 'command enchant>/dev/null || command enchant-2 -v>/dev/null || sudo yum -y install enchant || (echo "enchant command not found - please install it (e.g. sudo apt-get install enchant | yum install enchant )" >&2 && exit 1)'
+ sphinx-build -q -W -b spelling -d {envtmpdir}/doctrees ./docs/ {toxinidir}/docs/_build/spelling
-[testenv:docs-linkcheck]
-deps = -rrequirements.txt
-commands = sphinx-build -b linkcheck -d {envtmpdir}/doctrees ./docs/ {toxinidir}/docs/_build/linkcheck