Skip to content

target_summary is defined twice in validate_keys #3372

Description

@adamtheturtle

What happens

validate_keys in src/mock_vws/_services_validators/key_validators.py defines target_summary twice, identically:

target_summary = _Route(
    path_pattern=f"/summary/{target_id_pattern}",
    http_methods={HTTPMethod.GET},
    mandatory_keys=set(),
    optional_keys=set(),
)

at line 93 and again at line 127. The second assignment overwrites the first with the same value, so only one of the two ends up in the routes tuple and behaviour is unaffected.

Why it matters

It is dead code, and it is a small piece of evidence for #3371: the function is long enough that a duplicated block sits in it unnoticed, past ruff with ALL selected, pylint, vulture and the rest of the lint suite. None of those catch a redundant reassignment of a local.

Suggested resolution

Delete one of the two.

Worth checking whether ruff or pylint has a rule for redundant local reassignment which is currently disabled, so this class of thing is caught rather than found by reading.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions