Skip to content

pr_review.py reply --match: an ASCII double-hyphen and an em dash still miss each other #1876

Description

@ptr727

Context

Split out of #1299 during its own local-strict-review pass, which flagged this as a related but out-of-scope gap in the same fix.

The defect

matching_threads() in scripts/pr_review.py folds a typographic em dash (U+2014) and en dash (U+2013) to a single ASCII hyphen -, per #1299's fix. It does not fold the common two-hyphen ASCII stand-in for an em dash, --, to the same single hyphen.

So a thread body written with a real em dash and a --match pattern typed with the conventional double-hyphen stand-in still miss each other, and the reverse also misses: a body using -- does not match a pattern copied with a real em dash. Concretely, "foo—bar".translate(FOLD) in "foo--bar" is False, and "foo--bar" in "foo—bar".translate(FOLD) is also False.

This is the same class of failure #1299 fixed (a --match string that reads as the same words as the body but does not select the thread), just for a different pair of spellings of the same punctuation.

Suggested fix

Fold -- (two consecutive ASCII hyphens) to the same single - the em/en dash already fold to, so both spellings of a dash converge on the substring compare.

Why it is a separate issue rather than part of #1299

#1299 asked for the typographic dash characters themselves to fold to their ASCII equivalent, which is done. Folding an ASCII digraph is a distinct, slightly broader normalization decision, worth its own review rather than silently widening #1299's scope.

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

    scriptA defect in hub tooling

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions