-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtox.ini
167 lines (149 loc) · 5.27 KB
/
tox.ini
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
[tox]
envlist = linters,pep8,pylint
minversion = 2.3
skipsdist = True
stxdir = {toxinidir}/../
[testenv]
usedevelop = False
install_command = pip install \
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/starlingx/root/raw/branch/master/build-tools/requirements/debian/upper-constraints.txt} \
{opts} {packages}
setenv = VIRTUAL_ENV={envdir}
OS_STDOUT_CAPTURE=1
OS_STDERR_CAPTURE=1
OS_TEST_TIMEOUT=60
deps = -r{toxinidir}/test-requirements.txt
[testenv:linters]
basepython = python3
allowlist_externals = bash
commands =
bash -c "find {toxinidir} \
-not \( -type d -name .?\* -prune \) \
-type f \
-not -name \*~ \
-not -name \*.md \
\( \
-name \*.sh \
-or -not -wholename \*/devstack/files/\* \
-wholename \*/devstack/\* \
\) \
-print0 | xargs -0 bashate -v -iE006"
bash -c "find {toxinidir} \
\( -name .tox -prune \) \
-o -type f -name '*.yaml' \
-print0 | xargs -0 yamllint -d '\{extends: relaxed, rules: \{line-length: \{max: 260\}\}\}'"
bash -c "cd {envdir}; \
cp {toxinidir}/fm-api/source/fm_api/constants.py .; \
cp {toxinidir}/fm-common/sources/fmAlarm.h .; \
cp {toxinidir}/fm-doc/fm_doc/* .; \
./checkEventYaml"
[testenv:pylint]
basepython = python3
deps = {[testenv]deps}
-e{toxinidir}/../config/tsconfig/tsconfig
-e{toxinidir}/../config/sysinv/cgts-client/cgts-client
-r{toxinidir}/requirements.txt
commands = pylint {posargs} --rcfile=./pylint.rc \
fm-api/source/fm_api \
fm-common/sources/fm_db_sync_event_suppression.py \
fm-rest-api/fm/fm \
python-fmclient/fmclient/fmclient
####
# Add flake8 as pep8 codestyle check.
[testenv:pep8]
basepython = python3
description =
Run style checks.
commands =
flake8
[flake8]
# H102 Apache 2.0 license header not found
# H104 File contains nothing but comments
# H105 Don't use author tags
# H301 one import per line
# H306 imports not in alphabetical order
# H401 docstring should not start with a space
# H403 multi line docstrings should end on a new line
# H404 multi line docstring should start without a leading new line
# H405 multi line docstring summary not separated with an empty line
# H702 Argument to ... must be a string
# H903 Windows style line endings not allowed in code
# W504 line break after binary operator
# W605 invalid escape sequence
# E123, E125 skipped as they are invalid PEP-8.
# E501 skipped because some of the code files include templates
# that end up quite wide
# E402,module level import not at top of file
# W504,line break after binary operator
# W605,invalid escape sequence '\w'
# E117,over-indented
# F633,use of >> is invalid with print function
# F841,local variable 'e' is assigned to but never used
# E741,ambiguous variable name 'l'
# E117,over-indented
# F632,use ==/!= to compare constant literals (str, bytes, int, float, tuple)
show-source = True
ignore = H102,H104,H105,H301,H306,H401,H403,H404,H405,H702,H903,
W504,W605,E123,E125,E501,E402,W504,W605,E117,F633,F841,E741,E117,F632
exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,release-tag-*
# TODO: H106 Do not put vim configuration in source files (off by default).
# H203 Use assertIs(Not)None to check for None (off by default).
# TODO: H904 Delay string interpolations at logging calls (off by default).
enable-extensions = H203
[testenv:venv]
basepython = python3
commands = {posargs}
[testenv:docs]
basepython = python3
deps = -r{toxinidir}/doc/requirements.txt
commands =
rm -rf doc/build
sphinx-build -a -E -W -d doc/build/doctrees -b html doc/source doc/build/html
allowlist_externals = rm
[testenv:releasenotes]
basepython = python3
deps = -r{toxinidir}/doc/requirements.txt
commands =
rm -rf releasenotes/build
sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
allowlist_externals =
rm
reno
[testenv:newnote]
basepython = python3
# Re-use the releasenotes venv
envdir = {toxworkdir}/releasenotes
deps = -r{toxinidir}/doc/requirements.txt
commands = reno new {posargs}
[testenv:api-ref]
basepython = python3
deps =
-r{toxinidir}/doc/requirements.txt
commands =
rm -rf api-ref/build
sphinx-build -W -b html -d api-ref/build/doctrees api-ref/source api-ref/build/html
allowlist_externals = rm
[testenv:build]
deps =
commands = {toxinidir}/devstack/build.sh
[testenv:functional]
basepython = python3
allowlist_externals = cat
commands = cat /etc/fm/fm.conf
[bandit]
# B101 assert_used
# B104 hardcoded_bind_all_interfaces
# B110 try_except_pass
# B324 hashlib
# B314 blacklist xml
# B506 yaml_load
skips = B101,B104,B110,B314,B324,B506
exclude=.tox,.eggs
[testenv:bandit]
basepython = python3
description = Bandit code scan for *.py files
deps = -r{toxinidir}/test-requirements.txt
commands = bandit --ini tox.ini -r fm-api/source/fm_api \
fm-common/sources/fm_db_sync_event_suppression.py \
fm-rest-api/fm/fm \
python-fmclient/fmclient/fmclient