Skip to content

Remove unreachable bin branch from handleCardBehavior #188

@arasaka-net

Description

@arasaka-net

handleCardBehavior contains a case "bin" branch for data-location, but no code path ever assigns "bin" to a card. Delete the dead branch, or — if a bin location is actually intended — wire it in and cover it with a test.

Context
handleCardBehavior in src/scripts/card.js switches on cardElement.getAttribute("data-location") and handles deck, hand, opponent-hand, board, and bin. A grep across src/ shows "bin" as a data-location value appears only inside that switch — updateCardArea never sets it, updateCardHoverArea never sets it, createCard initializes the attribute to "deck", and no external caller mutates it. The branch is therefore dead code. Dead branches confuse readers, inflate test-coverage goals, and mislead future implementers. The resolution is either to delete the branch or, if the feature was intended, to add the assignment and a test; the deletion is the low-risk, bounded option and the one this ticket requests.

Affected Files

  • src/scripts/card.js:193 — unreachable case "bin": inside handleCardBehavior
  • src/scripts/card.test.js — add a regression test asserting the enumerated locations are exhaustive and bin is not reachable

Requirements

  • The case "bin": block is removed from handleCardBehavior.
  • A test documents the remaining enumerated locations so reintroducing bin without wiring it is caught.
  • npm test and npm run lint both succeed after the change.

Verification

  • ! grep -n 'case "bin"' src/scripts/card.js
  • npm test -- card.test.js
  • npm run lint

Not In Scope

  • Do not design or implement a real discard-pile / bin feature — that is a product decision, not cleanup.
  • Do not refactor unrelated branches of handleCardBehavior.

Evidence

  • src/scripts/card.js:193case "bin": branch exists inside the handleCardBehavior switch
  • src/scripts/card.js:120-134updateCardArea only ever sets data-location to deck, hand, opponent-hand, or board
  • src/scripts/card.js:12createCard initializes data-location to "deck", never "bin"

Arasaka Queue Planning Division.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions