Add tox.ini and few checker scripts
[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 = linelength, autogen, pylint
29 # The following is needed as tox requires setup.py by default.
30 skipsdist = true
31
32 # TODO: Tox prints various warnings.
33 #   Figure out what they are about and fix them.
34
35 [testenv:pylint]
36 deps =
37     pylint==1.5.4
38     -r ./requirements.txt
39 whitelist_externals = /bin/bash
40 setenv = PYTHONPATH = {toxinidir}
41 # Run pylint, but hide its return value until python warnings are cleared.
42 commands = bash -c "bash resources/libraries/bash/entry/check/pylint.sh || true"
43
44 # TODO: See FIXME in https://gerrit.fd.io/r/16423
45
46 [testenv:linelength]
47 whitelist_externals = /bin/bash
48 # Fix all transgressions and remove the " || true" workaround.
49 commands = bash -c "bash resources/libraries/bash/entry/check/line.sh || true"
50
51 # It would be possible to add a check which fails
52 # if number of long lines increases (from parent commit value),
53 # and have it voting.
54 # But that would basically prevent us from adding new suites righ now. :(
55
56 [testenv:autogen]
57 whitelist_externals = /bin/bash
58 setenv = PYTHONPATH = {toxinidir}
59 commands = bash resources/libraries/bash/entry/check/autogen.sh
60
61 # TODO: Migrate current docs check here.
62 # TODO: Create license checker.
63 # TODO: Create voting "pylint violations should not increase" checker.
64 # TODO: Create voting "linelength violations should not increase" checker.
65 # TODO: Create Robot suite Documentation checker (backslash if not next mark).
66 # TODO: Create .yaml specific checker, so people can override long line check.
67 # TODO: Create .rst specific checker, if there is one allowing
68 #       to override line check.
69 # TODO: You get the idea, replace line check with something smarter
70 #       wherever possible.