This repository has been archived by the owner on Jan 12, 2024. It is now read-only.
generated from catalyst-cooperative/cheshire
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tox.ini
244 lines (225 loc) · 6.94 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
[tox]
envlist = ci
[testenv]
allowlist_externals =
bash
coverage
mypy
sphinx-build
twine
# shared directory for re-used packages
envdir = {toxinidir}/.env_tox
passenv =
CI
CONDA_PREFIX
GITHUB_*
GOOGLE_APPLICATION_CREDENTIALS
HOME
SQLALCHEMY_WARN_20
covargs = --cov={envsitepackagesdir}/intake_sqlite --cov-append --cov-report=xml
covreport = coverage report --sort=cover
#######################################################################################
# Code and Documentation Linters
#######################################################################################
[testenv:flake8]
description = Run the full suite of flake8 linters & static code analysis
skip_install = false
extras =
tests
commands =
flake8 --config tox.ini
[testenv:rstcheck]
description = Check formatting and syntax of RST files.
skip_install = false
extras =
tests
commands =
rstcheck --config tox.ini --recursive ./
[testenv:pre_commit]
description = Run git pre-commit hooks not covered by the other linters.
skip_install = false
extras =
tests
commands =
pre-commit run --all-files --show-diff-on-failure python-no-eval
pre-commit run --all-files --show-diff-on-failure python-no-log-warn
pre-commit run --all-files --show-diff-on-failure python-check-blanket-noqa
pre-commit run --all-files --show-diff-on-failure check-merge-conflict
pre-commit run --all-files --show-diff-on-failure check-yaml
pre-commit run --all-files --show-diff-on-failure check-case-conflict
pre-commit run --all-files --show-diff-on-failure debug-statements
pre-commit run --all-files --show-diff-on-failure name-tests-test
[testenv:bandit]
description = Check the codebase for common insecure code patterns.
skip_install = false
extras =
tests
commands =
bandit -r src/intake_sqlite/
[testenv:mypy]
description = Run mypy type checking on the codebase.
skip_install = false
extras =
tests
types
commands =
mypy --strict src tests
[testenv:linters]
description = Run the pre-commit, flake8 and bandit linters.
skip_install = false
extras =
{[testenv:pre_commit]extras}
{[testenv:bandit]extras}
{[testenv:rstcheck]extras}
{[testenv:flake8]extras}
{[testenv:mypy]extras}
commands =
{[testenv:pre_commit]commands}
{[testenv:bandit]commands}
{[testenv:rstcheck]commands}
{[testenv:flake8]commands}
{[testenv:mypy]commands}
#######################################################################################
# Lint and Build the Docs
#######################################################################################
[testenv:doc8]
description = Check the documentation input files for syntactical correctness.
skip_install = false
extras =
docs
commands =
doc8 docs/ README.rst
[testenv:docs]
description = Build the HTML docs from scratch using Sphinx.
skip_install = false
extras =
{[testenv:doc8]extras}
{[testenv:rstcheck]extras}
{[testenv:mypy]extras}
commands =
bash -c 'rm -rf docs/_build'
{[testenv:doc8]commands}
{[testenv:rstcheck]commands}
sphinx-build -W -b html docs docs/_build/html
#######################################################################################
# Test the code
#######################################################################################
[testenv:unit]
description = Run all the software unit tests.
extras =
tests
commands =
pytest {posargs} {[testenv]covargs} \
--doctest-modules {envsitepackagesdir}/intake_sqlite \
tests/unit
[testenv:integration]
description = Run all software integration tests
extras =
tests
commands =
pytest {posargs} {[testenv]covargs} tests/integration
[testenv:ci]
description = Run all continuous integration (CI) checks & generate test coverage.
skip_install = false
recreate = true
extras =
{[testenv:linters]extras}
{[testenv:docs]extras}
{[testenv:unit]extras}
{[testenv:integration]extras}
commands =
coverage erase
{[testenv:linters]commands}
{[testenv:docs]commands}
{[testenv:unit]commands}
{[testenv:integration]commands}
{[testenv]covreport}
#######################################################################################
# Software Package Build & Release
#######################################################################################
[testenv:build]
description = Prepare Python source and binary packages for release.
basepython = python3
skip_install = false
commands =
bash -c 'rm -rf build/* dist/*'
python setup.py sdist bdist_wheel
[testenv:testrelease]
description = Do a dry run of Python package release using the PyPI test server.
basepython = python3
skip_install = false
extras =
dev
commands =
{[testenv:build]commands}
twine check dist/*
twine upload --sign --verbose --repository testpypi --skip-existing dist/*
[testenv:release]
description = Release the package to the production PyPI server.
basepython = python3
skip_install = true
extras =
dev
commands =
{[testenv:build]commands}
twine check dist/*
twine upload --sign --verbose --skip-existing dist/*
#######################################################################################
# Configuration for various tools.
#######################################################################################
[pytest]
testpaths = .
addopts = --verbose
log_format = %(asctime)s [%(levelname)8s] %(name)s:%(lineno)s %(message)s
log_date_format= %Y-%m-%d %H:%M:%S
log_cli = True
log_cli_level = INFO
doctest_optionflags = NORMALIZE_WHITESPACE IGNORE_EXCEPTION_DETAIL ELLIPSIS
filterwarnings =
ignore:distutils Version classes are deprecated:DeprecationWarning
ignore:Creating a LegacyVersion:DeprecationWarning:pkg_resources[.*]
[flake8]
# A few linter errors and warnings that we are currently ignoring:
# * W503, W504: Line break before / after binary operator.
# * D401: Imperative mood.
# * E501: Overlong line
# * E203: Space before ':' (black recommends to ignore)
# * RST201,RST203,RST301: Google docstrings aren't RST until after being processed by
# Napoleon. See https://github.com/peterjc/flake8-rst-docstrings/issues/17
extend-ignore = W503,W504,D401,E501,E203,RST201,RST203,RST301,
inline-quotes = double
max-line-length = 88
docstring-convention = google
# Files and directories that should not be subject to linting
extend-exclude =
.env_tox,
.eggs,
build,
# We have a backlog of complex functions being skipped with noqa: C901
max-complexity = 10
format = ${cyan}%(path)s${reset}:${green}%(row)-4d${reset} ${red_bold}%(code)s${reset} %(text)s
rst-roles =
attr,
class,
doc,
func,
meth,
mod,
obj,
py:const,
ref,
user,
rst-directives =
envvar,
exception,
percent-greedy = 2
format-greedy = 2
[doc8]
max-line-length = 88
ignore-path =
docs/_build
[rstcheck]
report_level = warning
ignore_roles = pr,issue,user
ignore_messages = (Hyperlink target ".*" is not referenced\.$|Duplicate implicit target name:)
ignore_directives = bibliography,todo