-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathpyproject.toml
More file actions
224 lines (201 loc) · 6.34 KB
/
Copy pathpyproject.toml
File metadata and controls
224 lines (201 loc) · 6.34 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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"
[project]
name = "ha-omada-open-api"
version = "1.10.0"
description = "Home Assistant integration for TP-Link Omada Open API"
readme = "README.md"
requires-python = ">=3.14"
license = {text = "MIT"}
[tool.ruff]
required-version = ">=0.15.2"
target-version = "py314"
line-length = 88
[tool.ruff.lint]
select = [
"A001", # Variable shadowing a Python builtin
"ASYNC", # flake8-async
"B", # flake8-bugbear
"BLE", # flake8-blind-except
"C", # complexity
"D", # pydocstyle
"E", # pycodestyle errors
"F", # pyflakes/autoflake
"FLY", # flynt
"FURB", # refurb
"G", # flake8-logging-format
"I", # isort
"ICN", # import conventions
"INP", # flake8-no-pep420
"ISC", # flake8-implicit-str-concat
"LOG", # flake8-logging
"N", # pep8-naming
"PERF", # perflint
"PGH", # pygrep-hooks
"PIE", # flake8-pie
"PL", # pylint
"PT", # flake8-pytest-style
"PTH", # flake8-use-pathlib
"PYI", # flake8-pyi
"RET", # flake8-return
"RSE", # flake8-raise
"RUF", # ruff-specific rules
"S", # flake8-bandit
"SIM", # flake8-simplify
"SLF", # flake8-self
"SLOT", # flake8-slots
"T20", # flake8-print
"TC", # flake8-type-checking
"TID", # flake8-tidy-imports
"TRY", # tryceratops
"UP", # pyupgrade
"W", # pycodestyle warnings
]
ignore = [
"D202", # No blank lines allowed after function docstring
"D203", # 1 blank line required before class docstring
"D213", # Multi-line docstring summary should start at the second line
"D406", # Section name should end with a newline
"D407", # Section name underlining
"D417", # Missing argument descriptions in docstring
"E501", # Line too long (handled by formatter)
"PLR0911", # Too many return statements
"PLR0912", # Too many branches
"PLR0913", # Too many arguments to function call
"PLR0915", # Too many statements
"PLR2004", # Magic value used in comparison
"PT011", # pytest.raises() is too broad
"BLE001", # blind exception catches (intentional in error-resilient code paths)
"PLC0415", # import at top-level (lazy imports for circular dep avoidance)
"S105", # Possible hardcoded password (false positives for config constants)
"S106", # Possible hardcoded password assigned to argument (test false positives)
"SIM102", # Use a single if statement instead of nested if statements
"SIM103", # Return the condition directly
"SIM108", # Use ternary operator
"TRY003", # Avoid specifying long messages outside the exception class
"TRY300", # Consider moving statement to else block (style preference)
"UP031", # Use format specifiers instead of percent format
"UP032", # Use f-string instead of format call
]
[tool.ruff.lint.flake8-import-conventions.extend-aliases]
voluptuous = "vol"
"homeassistant.helpers.config_validation" = "cv"
"homeassistant.helpers.device_registry" = "dr"
"homeassistant.helpers.entity_registry" = "er"
"homeassistant.util.dt" = "dt_util"
[tool.ruff.lint.flake8-pytest-style]
fixture-parentheses = false
mark-parentheses = false
[tool.ruff.lint.isort]
force-sort-within-sections = true
known-first-party = ["custom_components.omada_open_api"]
combine-as-imports = true
split-on-trailing-comma = false
[tool.ruff.lint.mccabe]
max-complexity = 25
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F401"]
"tests/**" = [
"D", # Don't require docstrings in tests
"S101", # Allow assert in tests
"SLF001", # Allow private member access in tests
"PLR2004", # Allow magic values in tests
"TC", # Don't require type-checking blocks in tests
]
[tool.pylint.MAIN]
py-version = "3.14"
jobs = 2
persistent = false
fail-on = ["I"]
[tool.pylint.BASIC]
class-const-naming-style = "any"
[tool.pylint."MESSAGES CONTROL"]
disable = [
"format",
"abstract-method",
"broad-exception-caught",
"cyclic-import",
"duplicate-code",
"import-error",
"import-outside-toplevel",
"inconsistent-return-statements",
"locally-disabled",
"not-context-manager",
"suppressed-message",
"too-few-public-methods",
"too-many-ancestors",
"too-many-arguments",
"too-many-instance-attributes",
"too-many-lines",
"too-many-locals",
"too-many-positional-arguments",
"too-many-public-methods",
"too-many-boolean-expressions",
"too-many-return-statements",
"unexpected-keyword-arg",
"unused-argument",
"useless-suppression",
"wrong-import-order",
]
enable = [
"use-symbolic-message-instead",
]
[tool.pylint.REPORTS]
score = false
[tool.pylint.FORMAT]
expected-line-ending-format = "LF"
[tool.pytest.ini_options]
testpaths = ["tests"]
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "function"
python_files = ["test_*.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
log_format = "%(asctime)s.%(msecs)03d %(levelname)-8s %(threadName)s %(name)s:%(filename)s:%(lineno)s %(message)s"
log_date_format = "%Y-%m-%d %H:%M:%S"
filterwarnings = [
"error",
"ignore::pytest.PytestUnraisableExceptionWarning",
]
[tool.mypy]
python_version = "3.14"
show_error_codes = true
follow_imports = "normal"
local_partial_types = true
strict_equality = true
no_implicit_optional = true
warn_incomplete_stub = true
warn_redundant_casts = true
warn_unused_configs = true
warn_unused_ignores = true
enable_error_code = ["ignore-without-code", "redundant-self", "truthy-iterable"]
disable_error_code = ["annotation-unchecked"]
strict = true
check_untyped_defs = true
disallow_incomplete_defs = true
disallow_subclassing_any = true
disallow_untyped_calls = true
disallow_untyped_decorators = true
disallow_untyped_defs = true
warn_return_any = true
warn_unreachable = true
ignore_missing_imports = true
[[tool.mypy.overrides]]
module = "tests.*"
disallow_untyped_defs = false
disallow_untyped_calls = false
[tool.coverage.run]
source = ["custom_components"]
omit = ["tests/*"]
[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"def __repr__",
"raise AssertionError",
"raise NotImplementedError",
"if TYPE_CHECKING:",
"@overload",
]