Skip to content

Commit

Permalink
Add ruff config
Browse files Browse the repository at this point in the history
  • Loading branch information
ludeeus committed Jul 22, 2024
1 parent 08939a0 commit 98e693c
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 3 deletions.
43 changes: 43 additions & 0 deletions .ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# The contents of this file is based on https://github.com/home-assistant/core/blob/dev/pyproject.toml

target-version = "py312"

[lint]
select = [
"ALL",
]

ignore = [
"ANN001", # Missing type annotation for function argument
"ANN101", # Missing type annotation for `self` in method
"ANN201", # Missing return type annotation for public function
"ANN202", # Missing return type annotation for private function
"ANN204", # Missing return type annotation for special method
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed
"ARG001", # Unused function argument: `hass`
"BLE001", # Do not catch blind exception: `Exception
"COM812", # incompatible with formatter
"D102", # Missing docstring in public method
"D107", # Missing docstring in `__init__`
"D203", # no-blank-line-before-class (incompatible with formatter)
"D212", # multi-line-summary-first-line (incompatible with formatter)
"D400", # First line should end with a period
"D401", # First line of docstring should be in imperative mood
"D404", # First word of the docstring should not be "This"
"D415", # First line should end with a period, question mark, or exclamation point
"FBT003", # Boolean positional value in function call
"ISC001", # incompatible with formatter
"PLR0913", # Too many arguments in function definition
"PTH110", # `os.path.exists()` should be replaced by `Path.exists()`
"RET505", # Unnecessary `else` after `return` statement
"TRY300", # Consider moving this statement to an `else` block
]

[lint.flake8-pytest-style]
fixture-parentheses = false

[lint.pyupgrade]
keep-runtime-typing = true

[lint.mccabe]
max-complexity = 25
3 changes: 1 addition & 2 deletions custom_components/healthchecksio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ async def async_unload_entry(
hass: core.HomeAssistant, config_entry: config_entries.ConfigEntry
) -> bool:
"""Unload a config entry."""

unload_ok = await hass.config_entries.async_forward_entry_unload(
config_entry, Platform.BINARY_SENSOR
)
Expand Down Expand Up @@ -142,7 +141,7 @@ async def check_files(hass: core.HomeAssistant) -> bool:
base = f"{hass.config.path()}/custom_components/{DOMAIN}/"
missing = []
for file in REQUIRED_FILES:
fullpath = "{}{}".format(base, file)
fullpath = f"{base}{file}"
if not os.path.exists(fullpath):
missing.append(file)

Expand Down
2 changes: 1 addition & 1 deletion custom_components/healthchecksio/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
BinarySensorDevice as BinarySensorEntity,
)

from .const import ATTRIBUTION, BINARY_SENSOR_DEVICE_CLASS, DOMAIN_DATA, DOMAIN
from .const import ATTRIBUTION, BINARY_SENSOR_DEVICE_CLASS, DOMAIN, DOMAIN_DATA


async def async_setup_entry(hass, config_entry, async_add_devices):
Expand Down

0 comments on commit 98e693c

Please sign in to comment.