-
Notifications
You must be signed in to change notification settings - Fork 21
/
tox.ini
252 lines (233 loc) · 7 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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
[gh-actions]
python =
3.9: py39
3.10: py310
3.11: py311, rst_linux, readme, rst, linters, coverage-report, qa
3.12: py312
[tox]
envlist = py39, py310, py311, py312, rst_linux, readme, rst, linters, coverage-report, qa
[testenv]
deps =
-r{toxinidir}/requirements.txt
-r{toxinidir}/requirements_dev.txt
pytest-cov
coverage>=4.2
commands =
# coverage run --rcfile=tox.ini -m pytest tests
python -m pip install --upgrade pip
pip install .
python -m pytest --cov-config=.coveragerc --cov=procrustes procrustes
# pytest --cov-config=.coveragerc --cov=procrustes/test
# can run it if needed
# coverage report -m
# prevent exit when error is encountered
ignore_errors = true
[testenv:readme]
skip_install = true
deps =
readme_renderer
twine
build
commands =
# checks whether distribution’s long description will render correctly on PyPI
python -m build
twine check dist/*
[testenv:rst_linux]
platform =
linux
skip_install = true
deps =
doc8
rstcheck>=6.2.4
ignore_outcome = true
commands =
doc8 --config tox.ini doc/
# ignore code-block related error because
# the Sphinx support in rstcheck is minimal. This results in false positives
# rstcheck uses Docutils to parse reStructuredText files and extract code blocks
# https://rstcheck.readthedocs.io/en/latest/usage/cli/
rstcheck --recursive doc/ --report-level error \
--ignore-directives automodule,autoclass,autofunction,bibliography,code-block \
--ignore-roles cite,mod,class,lineno --ignore-messages code-block
# [testenv:rst_mac]
# platform =
# darwin
# skip_install = true
# deps = {[testenv:rst_linux]deps}
# commands = {[testenv:rst_linux]commands}
[testenv:linters]
deps =
-r{toxinidir}/requirements.txt
-r{toxinidir}/requirements_dev.txt
pytest
flake8>=4.0.1
flake8-docstrings>=1.6.0
# flake8 import order checking conflicts with isort
# because the import order is checked by pylint, we can disable it here
# flake8-import-order>=0.18.1
flake8-pyproject
flake8-colors>=0.1.9
pep8-naming>=0.12.1
pylint>=2.13.4
# black
bandit>=1.7.4
ignore_errors = true
commands =
flake8 procrustes/
python -m pylint procrustes --rcfile=pyproject.toml --disable=similarities
# black -l 100 --check ./
# black -l 100 --diff ./
# Use bandit configuration file
bandit -r procrustes -c .bandit.yml
[testenv:coverage-report]
deps = coverage>=4.2
skip_install = true
commands =
# coverage combine --rcfile=tox.ini
coverage report
[testenv:qa]
deps =
{[testenv]deps}
{[testenv:linters]deps}
{[testenv:coverage-report]deps}
commands =
{[testenv]commands}
{[testenv:linters]commands}
# {[testenv:coverage-report]commands}
ignore_errors = true
# pytest configuration
[pytest]
addopts = --cache-clear
--showlocals
-v
-r a
testpaths = procrustes/test
# Enable line length testing with maximum line length of 100
pep8maxlinelength = 100
# Do not run tests in the build folder
norecursedirs = build
# flake8 configuration
[flake8]
exclude =
__init__.py,
.tox,
.git,
__pycache__,
build,
dist,
*.pyc,
*.egg-info,
.cache,
.eggs,
max-line-length = 100
import-order-style = google
ignore =
# E121 : continuation line under-indented for hanging indent
E121,
# E123 : closing bracket does not match indentation of opening bracket’s line
E123,
# E126 : continuation line over-indented for hanging indent
E126,
# E226 : missing whitespace around arithmetic operator
E226,
# E241 : multiple spaces after ‘,’
# E242 : tab after ‘,’
E24,
# E704 : multiple statements on one line (def)
E704,
# W503 : line break occurred before a binary operator
W503,
# W504 : Line break occurred after a binary operator
W504,
# D202: No blank lines allowed after function docstring
D202,
# E203: Whitespace before ':'
E203,
# E731: Do not assign a lambda expression, use a def
E731,
# doc8 configuration
[doc8]
# Ignore target directories and autogenerated files
ignore-path = doc/_build/, build/, procrustes.egg-info/, qc_procrustes.egg-info, .*/, doc/intro_about.rst
# File extensions to use
extensions = .rst, .txt
# Maximal line length should be 100
max-line-length = 100
# Disable some doc8 checks:
# D000: Check RST validity (cannot handle the "linenos" directive)
# D002: Trailing whitespace
# D004: Found literal carriage return
# Both D002 and D004 can be problematic in Windows platform, line ending is `\r\n`,
# but in Linux and MacOS, it's "\n"
# Known issue of doc8, https://bugs.launchpad.net/doc8/+bug/1756704
# ignore = D000,D002,D004
ignore = D000
# pylint configuration
[MASTER]
# This is a known issue of pylint with recognizing numpy members
# https://github.com/PyCQA/pylint/issues/779
# https://stackoverflow.com/questions/20553551/how-do-i-get-pylint-to-recognize-numpy-members
extension-pkg-whitelist=numpy
[FORMAT]
# Maximum number of characters on a single line.
max-line-length=100
# Maximum number of lines in a module
max-module-lines=2000
[MESSAGES CONTROL]
disable=
# attribute-defined-outside-init (W0201):
# Attribute %r defined outside __init__ Used when an instance attribute is
# defined outside the __init__ method.
W0201,
# too-many-instance-attributes (R0902):
# Too many instance attributes (%s/%s) Used when class has too many instance
# attributes, try to reduce this to get a simpler (and so easier to use)
# class.
R0902,
# too many branches (R0912)
R0912,
# too-many-arguments (R0913):
# Too many arguments (%s/%s) Used when a function or method takes too many
# arguments.
R0913,
# Too many local variables (r0914)
R0914,
# Too many statements (R0915)
R0915,
# fixme (W0511):
# Used when a warning note as FIXME or XXX is detected.
W0511,
# bad-continuation (C0330):
# Wrong hanging indentation before block (add 4 spaces).
C0330,
# wrong-import-order (C0411):
# %s comes before %s Used when PEP8 import order is not respected (standard
# imports first, then third-party libraries, then local imports)
C0411,
# arguments-differ (W0221):
# Parameters differ from %s %r method Used when a method has a different
# number of arguments than in the implemented interface or in an overridden
# method.
W0221,
# unecessary "else" after "return" (R1705)
R1705,
# Value XX is unsubscriptable (E1136). this is a open issue of pylint
# https://github.com/PyCQA/pylint/issues/3139
E1136,
# Used when a name doesn't doesn't fit the naming convention associated to its type
# (constant, variable, class…).
C0103,
# Used when too many positional arguments are given in a function call.
R0917,
[SIMILARITIES]
min-similarity-lines=5
# coverage configuration
[run]
branch = True
parallel = True
source = procrustes
[paths]
source =
procrustes
.tox/*/lib/python*/site-packages/procrustes
.tox/pypy*/site-packages/procrustes