| # tox (https://tox.readthedocs.io/) is a tool for running tests |
| # in multiple virtualenvs. This configuration file will run the |
| # test suite on all supported python versions. To use it, "pip install tox" |
| # and then run "tox" from this directory. |
| |
| [tox] |
| envlist = py36 |
| # There is no proper way to install the app for now (i.e. setup.py) |
| skipsdist = True |
| |
| [testenv] |
| deps = |
| -rrequirements.txt |
| psycopg2 |
| commands = |
| python manage.py test |
| |
| # Linters |
| [testenv:flake8] |
| deps = |
| -rrequirements-dev-flake8.txt |
| commands = |
| flake8 crashreports crashreport_stats hiccup |
| |
| [testenv:pylint] |
| deps = |
| -rrequirements.txt |
| -rrequirements-dev-pylint.txt |
| commands = |
| pylint crashreports crashreport_stats hiccup |
| |
| [testenv:linters] |
| deps = |
| {[testenv:flake8]deps} |
| {[testenv:pylint]deps} |
| commands = |
| {[testenv:flake8]commands} |
| {[testenv:pylint]commands} |
| |
| # Git pre-commit hooks: Run formatter and linters |
| [testenv:pre-commit-hooks] |
| deps = |
| -rrequirements.txt |
| -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 |
| {toxinidir}/tools/hooks/pre-commit.d/pre-commit-pylint.sh |
| |
| # 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 |
| max-complexity = 10 |
| max-line-length = 80 |
| |
| # Documentation |
| # Shared commands for both docs options |
| [docs] |
| swagger_version = 1.3.3 |
| commands = |
| python manage.py generate_swagger --overwrite documentation/hiccup-api.json |
| wget -nc https://jcenter.bintray.com/io/github/swagger2markup/swagger2markup-cli/{[docs]swagger_version}/swagger2markup-cli-{[docs]swagger_version}.jar |
| whitelist_externals= |
| java |
| wget |
| |
| # Create markdown docs |
| [testenv:docs] |
| deps = {[testenv]deps} |
| commands = |
| {[docs]commands} |
| java -jar swagger2markup-cli-{[docs]swagger_version}.jar convert \ |
| -f documentation/api-endpoints \ |
| -i documentation/hiccup-api.json \ |
| -c documentation/swagger.properties |
| whitelist_externals = {[docs]whitelist_externals} |
| |
| # Create HTML docs |
| [testenv:docs-html] |
| deps = {[testenv]deps} |
| commands = |
| {[docs]commands} |
| java -jar swagger2markup-cli-{[docs]swagger_version}.jar convert \ |
| -f documentation/api-endpoints \ |
| -i documentation/hiccup-api.json \ |
| -c documentation/swagger-asciidoc.properties |
| asciidoctor documentation/api-endpoints.adoc |
| whitelist_externals = |
| {[docs]whitelist_externals} |
| asciidoctor |