# Lint config for CI. # # The rule set is broad on purpose and tracks Home Assistant core's conventions # reasonably closely, so that this integration would not need a rewrite to be # read by anyone used to HA code. # # CI pins the ruff version (see .gitea/workflows/ci.yml) because ruff's default # rule set and formatter output change between releases. target-version = "py312" line-length = 88 # Dated design records. They contain illustrative, intentionally incomplete # code blocks and are not maintained source. exclude = ["docs"] [lint] select = [ "A", # flake8-builtins "ARG", # flake8-unused-arguments "ASYNC", # flake8-async "B", # flake8-bugbear "BLE", # flake8-blind-except "C4", # flake8-comprehensions "D", # pydocstyle "E", # pycodestyle errors "F", # pyflakes "FLY", # flynt "G", # flake8-logging-format "I", # isort "ICN", # flake8-import-conventions "INP", # flake8-no-pep420 "ISC", # flake8-implicit-str-concat "LOG", # flake8-logging "N", # pep8-naming "PERF", # perflint "PIE", # flake8-pie "PT", # flake8-pytest-style "PTH", # flake8-use-pathlib "Q", # flake8-quotes "RET", # flake8-return "RSE", # flake8-raise "RUF", # ruff-specific "S", # flake8-bandit "SIM", # flake8-simplify "SLF", # flake8-self "TID", # flake8-tidy-imports "TRY", # tryceratops "UP", # pyupgrade "W", # pycodestyle warnings ] ignore = [ # Wants every raise to use a purpose-built exception class whose message is # baked in, rather than `raise DknConnectionError("Request timed out")`. # That trades readable, situation-specific messages for a pile of # single-use classes. Home Assistant core disables this rule too. "TRY003", # Wants `async with asyncio.timeout(...)` at the call site instead of a # `timeout` parameter. The wait helpers here use the timeout value for # scheduling decisions (e.g. refreshing at the halfway point), not just for # cancellation, so the value has to be passed in. "ASYNC109", ] [lint.per-file-ignores] # Standalone scripts, deliberately not packages, and printing to stdout is # their entire job. "scripts/*" = ["INP001", "T201"] "smoke-test/*" = ["INP001", "T201"] [lint.isort] # Home Assistant core style. force-sort-within-sections = true combine-as-imports = true [lint.flake8-tidy-imports] ban-relative-imports = "parents" [lint.pydocstyle] convention = "pep257"