forked from sourcebots/sbot_simulator
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pyproject.toml
110 lines (92 loc) · 3.22 KB
/
pyproject.toml
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
# ### Linting Rules ###
[tool.ruff]
target-version = "py39"
line-length = 95
lint.select = [
"D", # pydocstyle
"E", # pycodestyle error
"F", # pyflakes
"I", # isort
"W", # pycodestyle warning
"RUF", # ruff-specific
"B006", # mutable default argument
"B021", # f-string docstring
"COM818", # warn about implicitly creating a tuple
"SLF001", # warn about accessing private members, these can be noqa'd when necessary
]
lint.preview = true # Enable preview to get the rest of pycodestyle errors
lint.ignore = [
"D104", # Ignore missing docstring in public package
"D105", # Ignore missing docstring in magic method
"D107", # Ignore missing docstring in __init__
"D401", # Ignore first line of docstring should be in imperative mood
"D203", # Ignore 1 blank line required before class docstring
"D212", # Ignore Multi-line docstring summary should start at the first line
"RUF005", # Allow alternate iterable unpacking
"RUF015", # Allow + concatenation
]
extend-exclude = ["zone_*/**.py"] # Exclude actual robot code from linting
[tool.ruff.lint.per-file-ignores]
# Ignore not having docstrings in example code
"example_robots/*.py" = ["D1"]
# ### Formatting Rules ###
[tool.mypy]
# Add Webots controller path to mypy
mypy_path = """
/Applications/Webots.app/Contents/lib/controller/python:\
/usr/local/webots/lib/controller/python:\
C:/Program Files/Webots/lib/controller/python:\
stubs\
"""
warn_unused_ignores = true
warn_return_any = true
show_error_codes = true
strict_optional = true
implicit_optional = true
disallow_any_unimported = true
disallow_subclassing_any = true
#disallow_any_generics = true
disallow_untyped_calls = true
disallow_untyped_defs = true
disallow_incomplete_defs = true
disallow_untyped_decorators = true
check_untyped_defs = true
[[tool.mypy.overrides]]
# Webots controller code is not fully typed
module = [
"controller",
"controller.*"
]
ignore_errors = true
# ### Tasks ###
[tool.poe.env]
PYFOLDERS = "example_robots/ simulator/ test_simulator/ scripts/"
MYPYFOLDERS = "simulator/ scripts/"
[tool.poe.tasks.lint]
help = "Run ruff against the project to check for linting errors."
cmd = "ruff check $PYFOLDERS"
[tool.poe.tasks.type]
help = "Run mypy against the project to check for type errors."
cmd = "python -m mypy $MYPYFOLDERS"
# [tool.poe.tasks.test]
# help = "Run pytest against the project to check for test errors."
# cmd = "python -m pytest --cov=$PYMODULE --cov-report=term --cov-report=xml tests"
# [tool.poe.tasks.webots-test]
# help = "Run tests in Webots against the project to check for test errors."
# cmd = ""
[tool.poe.tasks.check]
help = "Check the project for linting, type and test errors."
sequence = ["lint", "type"]
# sequence = ["lint", "type", "test"]
[tool.poe.tasks.fix]
help = "Use ruff to fix any auto-fixable linting errors."
cmd = "ruff check --fix-only $PYFOLDERS"
[tool.poe.tasks.release]
help = "Build the release archive."
cmd = "python ./scripts/generate_release.py"
[tool.poe.tasks.setup]
help = "Setup the virtual environment for running Webots."
cmd = "python -m ./scripts/setup.py"
[tool.poe.tasks.clean]
help = "Clean the project of previous release artifacts."
script = "shutil:rmtree('dist', ignore_errors=1)"