-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtox.ini
158 lines (147 loc) · 4.49 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
[tox]
envlist = ci
[testenv]
allowlist_externals =
bash
coverage
pre-commit
flake8
pytest
# shared directory for re-used packages
envdir = {toxinidir}/.env_tox
passenv =
CI
CONDA_PREFIX
HOME
DAGSTER_HOME
GITHUB_*
API_KEY_EIA
GOOGLE_APPLICATION_CREDENTIALS
PUDL_INPUT
PUDL_OUTPUT
SQLALCHEMY_WARN_20
PUDL_RMI_*
setenv =
PUDL_RMI_INPUTS_DIR = {toxinidir}/inputs
PUDL_RMI_OUTPUTS_DIR = {toxinidir}/outputs
covargs = --cov={envsitepackagesdir}/pudl_rmi --cov-append --cov-report=xml
covreport = coverage report --sort=cover
###########################################################################
# Code and Documentation Linters
###########################################################################
[testenv:flake8]
description = Run all the flake8 linters on all the code in the repository.
skip_install = false
extras =
tests
commands =
flake8
[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:linters]
description = Run all of the configured linters.
skip_install = false
extras =
{[testenv:pre_commit]extras}
{[testenv:flake8]extras}
commands =
{[testenv:pre_commit]commands}
{[testenv:flake8]commands}
###########################################################################
# Test the code and validate data
###########################################################################
[testenv:integration]
description = Run all the software integration tests
extras =
tests
commands =
pytest {posargs} {[testenv]covargs} test/integration
[testenv:unit]
description = Run all the software unit tests.
extras =
tests
commands =
pytest {posargs} {[testenv]covargs} \
--doctest-modules {envsitepackagesdir}/pudl_rmi \
test/unit
[testenv:ci]
description = Run all continuous integration (CI) checks & generate test coverage.
skip_install = false
extras =
{[testenv:integration]extras}
{[testenv:unit]extras}
{[testenv:linters]extras}
commands =
coverage erase
{[testenv:linters]commands}
{[testenv:integration]commands}
{[testenv:unit]commands}
{[testenv]covreport}
###########################################################################
# Configuration for various tools.
###########################################################################
[pytest]
testpaths = .
addopts = --verbose --pdbcls=IPython.terminal.debugger:TerminalPdb
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
[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
# Files and directories that should be subject to linting
extend-exclude =
package_data,
.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