This repository has been archived by the owner on Nov 29, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtox.ini
165 lines (152 loc) · 4.76 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
[tox]
envlist = ci
[testenv]
allowlist_externals =
bash
coverage
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}/pudl_scrapers --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/pudl_scrapers/
[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}
commands =
{[testenv:pre_commit]commands}
{[testenv:bandit]commands}
{[testenv:rstcheck]commands}
{[testenv:flake8]commands}
#######################################################################################
# Test the code
#######################################################################################
[testenv:unit]
description = Run all the software unit tests.
extras =
tests
commands =
pytest {posargs} {[testenv]covargs} \
--doctest-modules {envsitepackagesdir}/pudl_scrapers \
tests
[testenv:ci]
description = Run all continuous integration (CI) checks & generate test coverage.
skip_install = false
recreate = true
extras =
{[testenv:linters]extras}
{[testenv:unit]extras}
commands =
coverage erase
{[testenv:linters]commands}
{[testenv:unit]commands}
{[testenv]covreport}
#######################################################################################
# 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