5fc3172c1a97686efb7d8a3c63ec88ba33ecd077
[csit.git] / tox.ini
1 # Copyright (c) 2019 Cisco and/or its affiliates.
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at:
5 #
6 #     http://www.apache.org/licenses/LICENSE-2.0
7 #
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
13
14 # Idea of this file is motivated by OpenDylight,
15 # especially its Integration/Test sub-project.
16
17 # This file requires active virtualenv with tox package installed,
18 # or python-tox system package installed.
19
20 # Usage:
21 # cd to CSIT root (other directories might use different tox.ini)
22 #   $ tox
23 # will execute all checks.
24 #  $ tox -e pylint
25 # will execute only checks defined in "pylint" tox environment.
26
27 [tox]
28 envlist = new_line_length, line_length, autogen, pylint
29 # The following is needed as tox requires setup.py by default.
30 skipsdist = true
31 # Just a shorthand to avoid long lines.
32 checker_dir = ./resources/libraries/bash/entry/check
33
34 # TODO: Tox prints various warnings. Figure them out and fix them.
35
36 [testenv:pylint]
37 deps =
38     pylint==1.5.4
39     -r ./requirements.txt
40 whitelist_externals = /bin/bash
41 setenv = PYTHONPATH = {toxinidir}
42 # Run pylint, but hide its return value until python warnings are cleared.
43 commands = bash -c "bash {[tox]checker_dir}/pylint.sh || true"
44
45 # TODO: See FIXME in https://gerrit.fd.io/r/16423
46
47 [testenv:line_length]
48 whitelist_externals = /bin/bash
49 # Fix all transgressions and remove the " || true" workaround.
50 commands = bash -c "bash {[tox]checker_dir}/line.sh || true"
51
52 [testenv:new_line_length]
53 whitelist_externals = /bin/bash
54 # Adding .svg, big .rst tables, .yaml and similar still requires long lines.
55 # As current implementation is too dumb to filter those out,
56 # the checker has to remain non-voting.
57 commands = bash -c "bash {[tox]checker_dir}/new_line.sh || true"
58
59 [testenv:autogen]
60 whitelist_externals = /bin/bash
61 setenv = PYTHONPATH = {toxinidir}
62 commands = bash {[tox]checker_dir}/autogen.sh
63
64 # TODO: Create voting checker to reject suites with Force Tags of other suite.
65 # TODO: Create voting checker against tags not in tag_documentation.rst file.
66 # TODO: Create voting "pylint violations should not increase" checker.
67 # TODO: Figure out how to make new_line checker voting.
68 # TODO: Migrate current docs check here.
69 # TODO: Create license checker.
70 # TODO: Create Robot suite Documentation checker (backslash if not next mark).
71 # TODO: Create .yaml specific checker, so people can override long line check.
72 # TODO: Create .rst specific checker, if there is one allowing
73 #       to override line check.
74 # TODO: You get the idea, replace line check with something smarter
75 #       wherever possible.