forked from splintered-reality/py_trees
-
Notifications
You must be signed in to change notification settings - Fork 4
/
tox.ini
170 lines (140 loc) · 4.75 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
################################################################################
# Tox Configuration
################################################################################
[constants]
source_locations =
py_trees
tests
# doc/examples
[tox]
envlist = py38, py310, ufmt, check, mypy38, mypy310
################################################################################
# PyTest
################################################################################
[testenv]
require_locked_deps = true
require_poetry = true
locked_deps =
pytest
pytest-console-scripts
pytest-cov
commands =
pytest -s tests/
pytest --cov
[coverage:run]
# ensure conditional branches are explored (important)
# https://coverage.readthedocs.io/en/latest/branch.html#branch
branch = true
######################################################################
# Ufmt (black + isort)
######################################################################
[testenv:ufmt]
description = Un-opinionated auto-formatting.
locked_deps =
ufmt
commands =
ufmt format {[constants]source_locations}
################################################################################
# Flake 8
################################################################################
[testenv:check]
skip_install = true
description = Formatting checks and linting (flake8 & ufmt check).
locked_deps =
darglint
flake8
flake8-bandit
flake8-docstrings
ufmt
commands =
flake8 {[constants]source_locations}
# ufmt check {[constants]source_locations}
################################################################################
# Flake 8 Configuration
#
# Don't require docstrings, but parse them correctly if they are there.
#
# D100 Missing docstring in public module
# D101 Missing docstring in public class
# D102 Missing docstring in public method
# D103 Missing docstring in public function
# D105 Missing docstring in magic method
# D107 Missing docstring in __init__
#
# Jamming docstrings into a single line looks cluttered.
#
# D200 One-line docstring should fit on one line with quotes
#
# Weakly prefer breaking before a binary operator, so suppress that warning.
# See https://github.com/python/peps/commit/c59c4376ad233a62ca4b3a6060c81368bd21e85b
#
# W503 line break before binary operator
#
################################################################################
[flake8]
# Relax checks in the tests dir
# - D*** documentation (docstrings)
# - S101 use of assert warning (bandit)
per-file-ignores =
tests/*: D, S101
# Match black line lengths
# max-line-length = 88
max-line-length = 120
# Avoid overly complex functions
# NB: this option by default is off, recommend complexity is 10
# https://en.wikipedia.org/wiki/Cyclomatic_complexity
max-complexity: 15
# darglint docstring matching implementation checks
# - short: one liners are not checked
# - long: one liners and descriptions without args/returns are not checked
strictness = long
docstring_style=sphinx
# From 2.1.x -> unwind these checks
ignore = D100, D101, D102, D103, D105, D107, D200, W503, E501, F841, E251, E275, W504, E123, E302, E305, S314, E201, E202, E121, E126, F401, S10, S405, E221, S603, S607, S404, C901, S101
################################################################################
# Mypy
################################################################################
[testenv:mypy38]
skip_install = true
description = Static type checking against python 3.8.
locked_deps =
mypy
pytest
commands =
mypy --config-file {toxinidir}/tox.ini --python-version 3.8 {[constants]source_locations}
[testenv:mypy310]
skip_install = true
description = Static type checking against python 3.10.
commands =
mypy --config-file {toxinidir}/tox.ini --python-version 3.10 {[constants]source_locations}
locked_deps =
mypy
pytest
[mypy]
# With no options you get light coverage on some basics.
# In general, you'll want to go further. Even for new code, it's
# a great idea to enforce typehints on func args and returns as
# it immensively improves the readability and traceability of
# your code (and catches bugs!).
####################
# Good to have
####################
# Typehint all function args and returns
disallow_untyped_defs = True
# Unneeded # type: ignore comments.
warn_unused_ignores = True
# Complain if a function doesn't return anything when it should
warn_no_return = True
####################
# Stricter Options
####################
# Catch zombie code
warn_unreachable = True
# Type correctness between variables inside functions
check_untyped_defs = True
# Complain if a func isn't configured to return 'Any'
warn_return_any = True
# Check on casting operations
warn_redundant_casts = True
[mypy-pydot.*]
ignore_missing_imports = True