1
0
mirror of https://github.com/home-assistant/core.git synced 2026-02-14 23:28:42 +00:00

Handle missing argument in hass_enforce_type_hints (#152342)

This commit is contained in:
epenet
2025-09-15 09:45:27 +02:00
committed by GitHub
parent 22ea269ed8
commit bdc881c87a
2 changed files with 44 additions and 0 deletions

View File

@@ -3425,6 +3425,14 @@ class HassTypeHintChecker(BaseChecker):
# Check that all positional arguments are correctly annotated.
if match.arg_types:
for key, expected_type in match.arg_types.items():
if key > len(node.args.args) - 1:
# The number of arguments is less than expected
self.add_message(
"hass-argument-type",
node=node,
args=(key + 1, expected_type, node.name),
)
continue
if node.args.args[key].name in _COMMON_ARGUMENTS:
# It has already been checked, avoid double-message
continue