-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathpyproject.toml
More file actions
195 lines (174 loc) · 5.11 KB
/
pyproject.toml
File metadata and controls
195 lines (174 loc) · 5.11 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
[project]
name = "bmw_wallbox"
version = "1.1.2"
description = "Home Assistant integration for BMW Wallbox using OCPP 2.0.1"
readme = "README.md"
requires-python = ">=3.11"
license = {text = "MIT"}
authors = [
{name = "João Belo", email = ""},
]
keywords = ["homeassistant", "ocpp", "wallbox", "bmw", "ev-charging"]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: End Users/Desktop",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Home Automation",
]
[tool.ruff]
# Home Assistant targets Python 3.11+
target-version = "py311"
# Same as Home Assistant core
line-length = 88
# Exclude patterns
exclude = [
".git",
".github",
".venv",
"venv",
"__pycache__",
"*.pyc",
".pytest_cache",
"build",
"dist",
]
# Enable specific rule sets following Home Assistant standards
lint.select = [
"A", # flake8-builtins
"ARG", # flake8-unused-arguments
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"COM", # flake8-commas
"E", # pycodestyle errors (includes blank line rules)
"F", # pyflakes
"I", # isort
"N", # pep8-naming
"PIE", # flake8-pie
"PL", # pylint
"PT", # flake8-pytest-style
"Q", # flake8-quotes
"RET", # flake8-return
"RSE", # flake8-raise
"RUF", # ruff-specific rules
"S", # flake8-bandit
"SIM", # flake8-simplify
"T20", # flake8-print
"UP", # pyupgrade
"W", # pycodestyle warnings (includes blank line warnings)
]
lint.ignore = [
"E501", # line too long (handled by formatter)
"S101", # use of assert (required for tests)
"PLR2004", # magic value comparison
"PLR0913", # too many arguments
"PLR0912", # too many branches
"PLR0915", # too many statements
"COM812", # trailing comma (conflicts with formatter)
"S105", # possible hardcoded password (false positives in tests)
"S106", # possible hardcoded password (false positives in tests)
"S108", # probable insecure usage of temp file/directory
"S104", # binding to all interfaces (needed for OCPP server)
"ARG001", # unused function argument (pytest fixtures)
"ARG002", # unused method argument (common in event handlers)
"N813", # camelcase imported as lowercase (OCPP patterns)
"N818", # exception naming (our names are clear)
"A002", # shadowing builtin (OCPP spec uses 'type')
"B007", # loop control variable not used (common pattern)
"RUF006", # store asyncio.create_task reference (not always needed)
"RUF012", # mutable class attributes (intentional constants)
"PLC0415", # import not at top-level (lazy imports)
"PLR1714", # merge multiple comparisons (readability)
]
# Additional blank line rules
[tool.ruff.lint.pycodestyle]
max-line-length = 88
[tool.ruff.lint.per-file-ignores]
# Tests can use magic values, asserts, and relative imports
"tests/*" = ["PLR2004", "S101", "PLR0913"]
[tool.ruff.lint.isort]
# Home Assistant import order
force-sort-within-sections = true
combine-as-imports = true
split-on-trailing-comma = false
# Known first party for this integration
known-first-party = ["custom_components.bmw_wallbox"]
[tool.ruff.lint.flake8-pytest-style]
fixture-parentheses = false
mark-parentheses = false
[tool.ruff.lint.mccabe]
# Maximum cyclomatic complexity
max-complexity = 25
[tool.ruff.lint.pylint]
max-args = 10
max-branches = 25
max-returns = 15
max-statements = 100
[tool.ruff.format]
# Use double quotes for strings
quote-style = "double"
# Indent with spaces
indent-style = "space"
# Like Black, respect magic trailing commas
skip-magic-trailing-comma = false
# Line endings
line-ending = "auto"
[tool.pytest.ini_options]
testpaths = ["tests"]
python_files = ["test_*.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
asyncio_mode = "auto"
addopts = [
"--strict-markers",
"--strict-config",
"-ra",
]
markers = [
"asyncio: mark test as async",
]
[tool.coverage.run]
source = ["custom_components/bmw_wallbox"]
omit = [
"tests/*",
"custom_components/bmw_wallbox/__init__.py",
]
[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"def __repr__",
"raise AssertionError",
"raise NotImplementedError",
"if __name__ == .__main__.:",
"if TYPE_CHECKING:",
"@abstractmethod",
]
show_missing = true
precision = 2
[tool.mypy]
python_version = "3.11"
show_error_codes = true
follow_imports = "silent"
ignore_missing_imports = true
strict_equality = true
warn_incomplete_stub = true
warn_redundant_casts = true
warn_unused_configs = true
warn_unused_ignores = 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
no_implicit_optional = true
warn_return_any = true
warn_unreachable = true
[[tool.mypy.overrides]]
# Less strict for tests
module = "tests.*"
disallow_untyped_calls = false
disallow_untyped_defs = false
disallow_incomplete_defs = false