-
Notifications
You must be signed in to change notification settings - Fork 4
/
tox.ini
123 lines (106 loc) · 3.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
################################################################################
# Tox Configuration
################################################################################
[constants]
source_locations =
py_trees_js
tests
[tox]
envlist = py38, py310, format, check
################################################################################
# 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:format]
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-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 various checks in the tests dir
# - D*** documentation (docstrings)
# - S101 use of assert warning (bandit)
# - F401 unused import (from . import in __init__.py files)
per-file-ignores =
tests/*: D, S101,
py_trees_js/__init__.py: F401,
py_trees_js/viewer/__init__.py: F401
# auto-generated files
py_trees_js/resources.py: D100, D103
py_trees_js/viewer/images_rc.py: D100, D103
py_trees_js/viewer/web_app_rc.py: D100, D103
py_trees_js/viewer/main_window_ui.py: D100, D101, D102, E402, F401
py_trees_js/viewer/web_view_ui.py: D100, D101, D102, E402, F401
# 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
# Relax some of the more annoying checks
# - C901 have a couple of stubborn methods (TODO)
# - D105 magic method docstrings
# - D107 prefer to include init args in the class documentation
# - W503 deprecated PEP8, pay attention to 504 instead
# https://www.flake8rules.com/rules/W503.html
# - W504 line break after operator (TODO)
ignore = C901, D105, D107, W503