Files
homeassistant-dkncloudna/ruff.toml
Kydoimosandanthropic/claude-opus-5 706580fab2
CI / Validate integration (pull_request) Successful in 40s
CI / Lint (pull_request) Successful in 49s
chore: drop HACS distribution and move CI to Gitea
The GitHub mirror is gone, so the HACS packaging and the GitHub-only CI
no longer have anything to run against.

Remove hacs.json and the .github/ workflow. Both of its jobs (hassfest
and hacs/action) were gated on `github.server_url == 'https://github.com'`
and are GitHub-hosted actions, so neither can run on the Gitea runner.

Replace them with .gitea/workflows/ci.yml:
  - lint: ruff check + ruff format --check, version pinned because ruff's
    default rule set and formatter output move between releases
  - validate: byte-compile, then scripts/validate_integration.py, which
    covers the part of hassfest that matters for a manually installed
    custom component (manifest keys, domain/directory agreement, and
    translations matching strings.json key for key)

README now documents manual installation only, and points at the local
CI commands. manifest.json documentation and issue_tracker point at the
Gitea repo; NOTICE keeps its upstream attribution.

Adopting ruff surfaced two real defects, fixed here:
  - climate.async_set_hvac_mode raised HomeAssistantError for an
    unsupported mode from inside a try that catches Exception, so the
    message was re-wrapped as "Failed to set HVAC mode: Unsupported HVAC
    mode: ...". The validation is now hoisted above the try.
  - config_flow.async_step_reauth_confirm swallowed unexpected exceptions
    into a bare "unknown" error with no log, unlike the user step. It now
    logs via _LOGGER.exception.

Remaining changes are mechanical: import ordering, docstrings on public
methods, ClassVar on mutable class attributes, contextlib.suppress, and
asyncio.TimeoutError -> TimeoutError (an alias since 3.11). The smoke
test now reads the new DknCloudNaClient.socket_connected property rather
than reaching into _socket.

Co-authored-by: anthropic/claude-opus-5
2026-09-19 10:09:11 -03:00

82 lines
2.5 KiB
TOML

# 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"