blob: efe3b380352716b97a4995a987c03c05fd907e2e [file] [log] [blame]
Sylvain Desbureaux3c393e52020-12-07 09:15:19 +01001[tox]
2minversion = 1.6
3envlist =
Sylvain Desbureauxec07bca2020-12-09 10:13:42 +01004 docs,
5 docs-linkcheck,
Sylvain Desbureaux3c393e52020-12-07 09:15:19 +01006 gitlint,
Guillaume Lambert85b14922021-03-12 13:53:18 +01007 checkbashisms,
guillaume.lambert30ec3902021-09-14 12:32:24 +02008 pre-commit,
Sylvain Desbureaux3c393e52020-12-07 09:15:19 +01009skipsdist=true
10
Sylvain Desbureauxec07bca2020-12-09 10:13:42 +010011[doc8]
12ignore-path-errors=docs/helm-search.txt;D001
13
14[testenv:doc8]
15deps = -rdocs/requirements-docs.txt
guillaume.lambertf3319a82021-09-26 21:37:50 +020016 doc8
Sylvain Desbureauxec07bca2020-12-09 10:13:42 +010017commands =
guillaume.lambertf3319a82021-09-26 21:37:50 +020018 - doc8 docs/
Sylvain Desbureauxec07bca2020-12-09 10:13:42 +010019
20[testenv:docs]
21deps = -rdocs/requirements-docs.txt
22commands =
guillaume.lambert91df0d82021-04-24 10:37:53 +020023 sphinx-build -q -W -b html -n -d {envtmpdir}/doctrees ./docs/ {toxinidir}/docs/_build/html
Sylvain Desbureauxec07bca2020-12-09 10:13:42 +010024
25[testenv:docs-linkcheck]
26deps = -rdocs/requirements-docs.txt
guillaume.lambert91df0d82021-04-24 10:37:53 +020027commands = sphinx-build -q -W -b linkcheck -d {envtmpdir}/doctrees ./docs/ {toxinidir}/docs/_build/linkcheck
Sylvain Desbureauxec07bca2020-12-09 10:13:42 +010028
Guillaume Lambertb825e912021-02-01 21:22:33 +010029[testenv:spelling]
30#basepython = python3
31whitelist_externals = wget
32deps =
33 -rdocs/requirements-docs.txt
34 sphinxcontrib-spelling
35 PyEnchant
36changedir={toxinidir}/docs
37commands =
Guillaume Lambert089ba212021-02-10 11:48:39 +010038 wget -nv https://git.onap.org/doc/plain/docs/spelling_wordlist.txt -O spelling_wordlist.txt
Guillaume Lambertb825e912021-02-01 21:22:33 +010039 sphinx-build -b spelling -d {envtmpdir}/doctrees . _build/spelling
40
Sylvain Desbureaux3c393e52020-12-07 09:15:19 +010041[testenv:gitlint]
42basepython = python3
43deps =
44 gitlint
45
46commands =
47 gitlint
48
Guillaume Lambertd8eab712021-03-08 21:49:28 +010049[testenv:checkbashisms]
50deps =
51whitelist_externals = sh
52 find
53 checkbashisms
54commands =
55 sh -c 'which checkbashisms>/dev/null || sudo yum install devscripts-minimal || sudo apt-get install devscripts \
56 || (echo "checkbashisms command not found - please install it (e.g. sudo apt-get install devscripts | \
57 yum install devscripts-minimal )" >&2 && exit 1)'
Guillaume Lambert85b14922021-03-12 13:53:18 +010058 find . -not -path '*/\.*' -name *.sh -exec checkbashisms \{\} +
Guillaume Lambertd8eab712021-03-08 21:49:28 +010059
Guillaume Lambert056b2d42021-02-17 12:09:47 +010060[testenv:autopep8]
61deps = autopep8
62commands =
63 autopep8 --max-line-length 120 --in-place --recursive kubernetes/ TOSCA/ docs/
64
65[testenv:pylint]
66deps = pylint
67whitelist_externals = find
68commands =
69 find kubernetes/ TOSCA/ docs/ -name *.py -exec pylint --max-line-length=120 --disable=missing-docstring --method-rgx="(([a-z_][a-zA-Z0-9_]{2,})|(_[a-z0-9_]*)|(__[a-zA-Z][a-zA-Z0-9_]+__))$" --variable-rgx="[a-zA-Z_][a-zA-Z0-9_]{1,30}$" --reports=y --score=y --output-format=colorized \{\} +
70
guillaume.lambert30ec3902021-09-14 12:32:24 +020071[testenv:pre-commit-install]
72basepython = python3
73deps = pre-commit
74commands =
75 pre-commit install
76 pre-commit install --hook-type commit-msg
77
78[testenv:pre-commit-uninstall]
79basepython = python3
80deps = pre-commit
81commands =
82 pre-commit uninstall
83 pre-commit uninstall --hook-type commit-msg
84
85[testenv:pre-commit]
86basepython = python3
87deps = pre-commit
88passenv = HOME
89commands =
90 pre-commit run --all-files --show-diff-on-failure
91 pre-commit run gitlint --hook-stage commit-msg --commit-msg-filename .git/COMMIT_EDITMSG
92 # Gitlint only proposes a pre-commit configuration for the commit-msg stage but none for the commit stage.
93 # Its default arguments --passed and --msg-filename are different from CI recommandations.
94 # As a result, the line above is always skipped in jenkins CI since there cannot be a .git/COMMIT_EDITMSG file.
95 # A dedicated gitlint profile for CI is proposed above. Also to behave fine locally, this profile must have access
96 # to the HOME variable so that Gitlint can retrieve Git user settings.