Skip to content

Fix e.g./i.e. punctuation rule to eliminate false positives on real words#35

Merged
ChrisChinchilla merged 2 commits into
mainfrom
copilot/improve-e-g-i-e-rule
Apr 4, 2026
Merged

Fix e.g./i.e. punctuation rule to eliminate false positives on real words#35
ChrisChinchilla merged 2 commits into
mainfrom
copilot/improve-e-g-i-e-rule

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 9, 2026

The old \b(?:eg|ie)[^,] pattern was matching legitimate words like "egg", "egress", and "ingredient". The rule has been rewritten using proper word boundaries and negative lookahead.

New Punctuation.yml

extends: substitution
message: "Use '%s' instead of '%s'"
level: warning
nonword: true
swap:
  'e\.g\.(?!,)': 'eg,'
  'i\.e\.(?!,)': 'ie,'
  '\beg\b(?!,)': 'eg,'
  '\bie\b(?!,)': 'ie,'
  • \beg\b / \bie\b — word boundaries prevent matching inside "egg", "egress", etc.
  • nonword: true — required for Vale to tokenize and match period-containing forms like "e.g." and "i.e."
  • (?!,) — skips already-correct usage ("eg,", "e.g.,")
  • Covers both period-form (e.g., i.e.) and bare abbreviation (eg, ie), enforcing a trailing comma in both cases

Test fixture update

features/rules.feature updated to match current actual Vale output — removes the false-positive "egg" alert lines and corrects the message format from 'eg, or ie,' to 'eg,'.

Original prompt

This section details on the original issue you should resolve

<issue_title>Come up with a better e.g., i.e. rule</issue_title>
<issue_description>#24</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: ChrisChinchilla <42080+ChrisChinchilla@users.noreply.github.com>
Copilot AI changed the title [WIP] Update e.g., i.e. rule for clarity Fix e.g./i.e. punctuation rule to eliminate false positives on real words Mar 9, 2026
@ChrisChinchilla ChrisChinchilla marked this pull request as ready for review April 4, 2026 08:34
@ChrisChinchilla ChrisChinchilla merged commit a48bdb3 into main Apr 4, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Come up with a better e.g., i.e. rule

2 participants