Skip to content

Duplication check: keep one qualifying place per token run so the 16-place cap cannot hide a real pair #42

Closed

Description

@kikashy

Follow-up from the review of #41 (re-read at 5dd5f44).

The detector keeps the 16 most recent places of each token run and compares them nearest first. That fixes the recorded case (a reflowed third copy that fails the line threshold hiding a real pair), but once 16 or more short copies of every run of a block sit between the two real copies, the real pair is dropped from the window and the check exits 0 again. The README states the bound.

Proposed fix: for each run, also keep the most recent place that itself spans at least min_lines lines, and never evict it. Two such places always make a reported pair, so the window size no longer decides whether a real pair is seen. Add a fixture with 17 short copies between two real ones (and the same-file variant) and confirm the test fails when the kept place is evicted.

Noted in the same re-read, no change needed now: total memory across many files under max_file_bytes is unbounded (the out-of-memory refusal covers it), and multipleOf: 1 is redundant with type: integer (50.0 is refused by name).

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

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions