[Bug] JS/TS identifiers with $ or under three characters are never matched by the dead-code name scan, so a read binding is reported as not used anywhere

Open
#6,412 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@Papito084 is already working on this.

Since Nov 26, 2026.

  • #6422 by @Papito084 — open
  • #6435 by @canblmz1 — open

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale

Research direction

Start with packages/core/src/repowise/core/analysis/dead_code/name_occurrences.py:80 and trace searchable_token at line 297. Check the other callers in analyzer.py, c_name_uses.py, and go_name_uses.py to preserve their current identifier shape. Add regression coverage under tests/unit/analysis/dead_code/ using the repro; done means neither read binding is reported, with the non-ASCII rule unchanged. Two open pull requests are already linked.

Written by the indexing model from the issue text.

Description

bug help wanted

Summary

The dead-code name scan only recognises identifiers of three or more characters made of [A-Za-z0-9_]. A JS/TS binding such as currentUser$ or ws is never matched, so the scan cannot see a read of it and the finding says "not used anywhere" although it is used.

packages/core/src/repowise/core/analysis/dead_code/name_occurrences.py:80

IDENTIFIER_RE = re.compile(rb"[A-Za-z_][A-Za-z0-9_]{2,}")

Mechanism

  • searchable_token (:297) returns empty for a name IDENTIFIER_RE cannot match, so the verdict is "not searchable" and the finding is only capped at 0.3 (UNVERIFIED_INTERNAL_CONFIDENCE), not cleared.
  • Such names rely on graph edges alone. A read the graph has no edge for stays flagged.

Repro

src/a.ts: const currentUser$ = makeStore(); const ws = makeStore(); function makeStore() { return {}; } export function run(cb) { cb(currentUser$); cb(ws); }, plus src/b.ts importing run. Then:

repowise dead-code --include-internals --kind unused_internal --min-confidence 0 --format json
"symbol_name": "currentUser$", "confidence": 0.3, "reason": "Private symbol 'currentUser$' is not used anywhere"
"symbol_name": "ws", "confidence": 0.3, "reason": "Private symbol 'ws' is not used anywhere"

Impact

Both are read in their own file. The 0.3 cap hides them by default, but the reason text is false and they surface at a lower threshold.

Done looks like

  • Admit $ in the identifier shape for JS/TS, and lower the minimum length for those languages, without changing searchable_token's non-ASCII rule.
  • Check the other callers of IDENTIFIER_RE (analyzer.py, c_name_uses.py, go_name_uses.py) keep their current shape.

Tests

tests/unit/analysis/dead_code/: the repro above reports neither binding.

Dominant language
Python
Stars
7.1k
Forks
756
Avg merge
21h 5m
Merged PRs (30d)
797

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from repowise-dev/repowise

All issues in repowise-dev/repowise

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.