Skip to content

Un-ignore the ty invalid-assignment rule (good first issue, part of #15187) #15199

Description

@priya-sundaram-dev

Feature description

This is a bite-sized, self-contained slice of the ty gradual-typing baseline tracked in #15187 — un-ignoring the invalid-assignment rule.

Right now [tool.ty] in pyproject.toml carries rules.invalid-assignment = "ignore". On a synced 3.14 environment ty reports 23 invalid-assignment diagnostics across 9 files — all small, local fixes (mostly linked-list/tree node attributes typed Node | None where a plain Node or None is assigned, plus a couple of narrow subscript/annotation mismatches). No cross-file churn, so it makes a clean good-first-issue.

Current diagnostics

  • cellular_automata/conways_game_of_life.py
  • cellular_automata/one_dimensional.py
  • data_structures/binary_tree/non_recursive_segment_tree.py
  • data_structures/heap/binomial_heap.py
  • data_structures/linked_list/doubly_linked_list.py
  • data_structures/linked_list/singly_linked_list.py
  • fractals/mandelbrot.py
  • machine_learning/automatic_differentiation.py
  • networking_flow/minimum_cut.py

How to fix

  1. uv sync, then run ty check --exclude-scripts and grep the output for invalid-assignment.
  2. Fix only these files — usually by widening/narrowing an attribute or variable annotation (e.g. typing a node's next/previous/left as Node | None at declaration), never by loosening runtime behaviour. Leave every other still-ignored rule untouched.
  3. Delete the rules.invalid-assignment = "ignore" line in [tool.ty].
  4. Confirm ty reports zero invalid-assignment diagnostics, and that the existing test/doctest suite still passes, then open the PR.

Keep the PR scoped to this one rule so it stays easy to review. Happy to review when it's up.

Additional context

Part of #15187. Please comment to claim before starting so we don't get duplicate PRs.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions