-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathpyproject.toml
More file actions
153 lines (139 loc) · 3.51 KB
/
pyproject.toml
File metadata and controls
153 lines (139 loc) · 3.51 KB
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
[project]
name = "SCRAM"
version = "1.5.1"
# ==== pytest ====
[tool.pytest.ini_options]
addopts = [
"--ds=config.settings.test",
"--reuse-db",
"--ignore=scheduler"
]
minversion = "6.0"
python_files = [
"tests.py",
"test_*.py",
]
# ==== Coverage ====
[tool.coverage.run]
branch = true
data_file = "coverage.coverage"
include = ["scram/*", "config/*", "translator/*"]
omit = ["**/migrations/*", "scram/contrib/*", "*/tests/*"]
plugins = ["django_coverage_plugin"]
[tool.coverage.report]
exclude_also = [
"if debug:",
"if self.debug:",
"if settings.DEBUG",
"raise AssertionError",
"raise NotImplementedError",
"if __name__ == .__main__.:",
]
# ===== ruff ====
[tool.ruff]
exclude = [
"migrations",
]
line-length = 119
preview = true
target-version = 'py312'
[tool.ruff.lint]
ignore = [
"COM812", # handled by the formatter
"DOC501", # add possible exceptions to the docstring (TODO)
"ISC001", # handled by the formatter
"RUF012", # need more widespread typing
"SIM102", # use a single `if` statement instead of nested `if` statements
"SIM108", # use ternary operator instead of `if`-`else`-block
"PERF401", # list comprehensions are harder to read in our opinion and not worth the performance gain
"PERF403", # dict comprehensions are harder to read in our opinion and not worth the performance gain
]
select = [
"A", # builtins
"ASYNC", # async
"B", # bugbear
"BLE", # blind-except
"C4", # comprehensions
"C90", # complexity
"COM", # commas
"D", # pydocstyle
"DJ", # django
"DOC", # pydoclint
"DTZ", # datetimez
"E", # pycodestyle
"EM", # errmsg
"ERA", # eradicate
"F", # pyflakes
"FBT", # boolean-trap
"FLY", # flynt
"G", # logging-format
"I", # isort
"ICN", # import-conventions
"ISC", # implicit-str-concat
"LOG", # logging
"N", # pep8-naming
"PERF", # perflint
"PIE", # pie
"PL", # pylint
"PTH", # use-pathlib
"Q", # quotes
"RET", # return
"RSE", # raise
"RUF", # Ruff
"S", # bandit
"SIM", # simplify
"SLF", # self
"SLOT", # slots
"T20", # print
"TRY", # tryceratops
"UP", # pyupgrade
]
[tool.ruff.lint.mccabe]
max-complexity = 7 # our current code adheres to this without too much effort
[tool.ruff.lint.per-file-ignores]
"**/tests/**" = [
"C901", # function is too complex (applies to test helpers)
"DOC201", # documenting return values
"DOC402", # documenting yield values
"FBT002", # boolean default argument in function definition
"PLR6301", # could be a static method
"S101", # use of assert
"S106", # hardcoded password
"PLR2004", # magic value used in comparison
]
"**/views.py" = [
"DOC201", # documenting return values; it's fairly obvious in a View
]
"scram/route_manager/**" = [
"DOC201", # documenting return values
]
"scram/users/**" = [
"DOC201", # documenting return values
"FBT001", # minimal issue; don't need to mess with in the User app
"PLR2004", # magic values when checking HTTP status codes
]
"test.py" = [
"S105", # hardcoded password as argument
]
[tool.ruff.lint.pydocstyle]
convention = "google"
# ==== mypy ====
[tool.mypy]
check_untyped_defs = true
ignore_missing_imports = true
plugins = [
"mypy_django_plugin.main",
"mypy_drf_plugin.main",
]
python_version = "3.11"
warn_redundant_casts = true
warn_unused_configs = true
warn_unused_ignores = true
[[tool.mypy.overrides]]
# Django migrations should not produce any errors:
ignore_errors = true
module = "*.migrations.*"
[tool.django-stubs]
django_settings_module = "config.settings.test"
[tool.uv.workspace]
members = ["scheduler", "translator"]