adaptive-lighting/.ruff.toml
Casey 1c56674379 Clean up all remaining ruff errors; lint is now fully green
Config:
- .ruff.toml target-version py310 -> py312, matching pyproject's
  requires-python (>=3.12) and the 3.12 'type' aliases switch.py
  already ships. Unblocks two false invalid-syntax errors.
- Ignore D102 in tests (test-class methods), consistent with the
  existing D100/D103 test ignores.

Code (no behavior changes):
- COM812 trailing commas + UP017 dt.UTC via ruff --fix, black re-wrap
- RUF002: unicode minus/en-dash -> ASCII hyphen in docstrings
- SIM105: contextlib.suppress for the lux-reading parse in config_flow
- TRY300: move return out of try in _read_lux_sensor
- PLC0415: hoist inline asyncio/logging imports to module top
- E741: rename ambiguous 'l' comprehension variable to light_id
- PT006/PT018: parametrize tuple + split compound assertion
- D102: docstring for OptionsFlow.async_step_init
- ARG001/ARG002: noqa with justification on HA-required signatures
- PLR0912/PLR0915: noqa on prepare_adaptation_data and
  _update_attrs_and_maybe_adapt_lights (upstream-inherited complexity;
  splitting would hurt readability more than it helps)

./scripts/lint passes clean; 148 tests pass.
2026-06-05 12:16:40 +02:00

61 lines
2.8 KiB
TOML

# The contents of this file is based on https://github.com/home-assistant/core/blob/dev/pyproject.toml
# Matches pyproject.toml's requires-python (>=3.12); switch.py already uses
# 3.12-only `type` alias statements.
target-version = "py312"
[lint]
select = ["ALL"]
# All the ones without a comment were the ones that are currently violated
# by the codebase. The plan is to fix them all (when sensible) and then enable them.
ignore = [
"ANN",
"ANN101", # Missing type annotation for {name} in method
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed in {name}
"D401", # First line of docstring should be in imperative mood
"E501", # line too long
"FBT001", # Boolean positional arg in function definition
"FBT002", # Boolean default value in function definition
"FIX004", # Line contains HACK, consider resolving the issue
"PD901", # df is a bad variable name. Be kinder to your future self.
"PERF203", # `try`-`except` within a loop incurs performance overhead
"PLR0913", # Too many arguments to function call (N > 5)
"PLR2004", # Magic value used in comparison, consider replacing X with a constant variable
"S101", # Use of assert detected
"SLF001", # Private member accessed
]
[lint.per-file-ignores]
"tests/*.py" = [
"ARG001", # Unused function argument: `call`
"D100", # Missing docstring in public module
"D102", # Missing docstring in public method (test-class methods)
"D103", # Missing docstring in public function
"D205", # 1 blank line required between summary line and description
"D400", # First line should end with a period
"D415", # First line should end with a period, question mark, or
"DTZ001", # The use of `datetime.datetime()` without `tzinfo`
"ERA001", # Found commented-out code
"FBT003", # Boolean positional value in function call
"FIX002", # Line contains TODO, consider resolving the issue
"G004", # Logging statement uses f-string
"PLR0915", # Too many statements (94 > 50)
"PT004", # Fixture `cleanup` does not return anything, add leading underscore
"PT007", # Wrong values type in `@pytest.mark.parametrize` expected `list` of
"S311", # Standard pseudo-random generators are not suitable for cryptographic
"TD002", # Missing author in TODO; try: `# TODO(<author_name>): ...` or `# TODO
"TD003", # Missing issue link on the line following this TODO
]
".github/*py" = ["INP001"]
"webapp/homeassistant_util_color.py" = ["ALL"]
"webapp/app.py" = ["INP001", "DTZ011", "A002"]
"custom_components/adaptive_lighting/homeassistant_util_color.py" = ["ALL"]
[lint.flake8-pytest-style]
fixture-parentheses = false
[lint.pyupgrade]
keep-runtime-typing = true
[lint.mccabe]
max-complexity = 25