Skip to content

feat(core): new AvoidContractions rule#3397

Merged
elijah-potter merged 2 commits into
masterfrom
feature/contractions
May 21, 2026
Merged

feat(core): new AvoidContractions rule#3397
elijah-potter merged 2 commits into
masterfrom
feature/contractions

Conversation

@elijah-potter
Copy link
Copy Markdown
Collaborator

Issues

No linked issue.

Description

Adds a new opt-in AvoidContractions linter that suggests expanded forms for common English contractions.

The rule covers deterministic contraction expansions such as:

  • isn'tis not
  • wasn'twas not
  • don'tdo not
  • can'tcannot
  • I'mI am
  • you'reyou are
  • they'llthey will

The rule is registered in the lint group and added to default_config.json under Style and Redundancy with state: false, so it is available but disabled by default.

Ambiguous contractions such as it's, he'd, and she's are intentionally excluded from this first implementation.

Demo

N/A

How Has This Been Tested?

Added unit tests for the new linter covering positive matches, suggestion output, casing behavior, typographic apostrophes, possessives/names, and intentionally excluded ambiguous contractions.

AI Disclosure

  • I am a human and didn't use any AI.
  • I used LLM features of my editor, but not an agent.
  • I used an AI agent interactively.
  • I am an agent or I got an agent to do the work autonomously.

If Your PR Implements or Enhances a Linter

  • I made up the sentences in the unit tests.
  • The sentences in the unit tests were generated by an AI.
  • I'm using examples from the bug report / feature request.
  • I collected real-world sentences for the unit tests.

Checklist

  • I have performed a self-review of my own code
  • I have added tests to cover my changes
  • I have considered splitting this into smaller pull requests.

Copy link
Copy Markdown
Collaborator

@hippietrail hippietrail left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

List of all the missing ones from dictionary.dict found using the regex ^[^/]*'[^/]*/

I made the full list before I went back to check for and find your note saying you left out the ones with multiple expansions intentionally. So those are mixed in with the missing ones with only a single expansion sorry.

"aren't",
"wasn't",
"weren't",
"don't",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be easier for us to scan for missing ones if these were alphasorted.

Missing, but this includes the ones with multiple expansions:

  • couldn't've
  • could've
  • he'd
  • he's
  • how'd
  • how're
  • I'd
  • I'd've
  • it'd
  • it's
  • mayn't
  • mightn't
  • might've
  • must've
  • oughtn't
  • shan't
  • she'd
  • she's
  • should've
  • that'd
  • that'll
  • that's
  • there'd
  • there'll
  • there's
  • they'd
  • we'd
  • what'll
  • what's
  • where'd
  • who'd
  • who'll
  • who're
  • who's
  • who've
  • why'd
  • would've
  • you'd

Maybe? Maybe not?

  • ne'er
  • nor'easter
  • sou'wester
  • y'all

@elijah-potter
Copy link
Copy Markdown
Collaborator Author

I went ahead and sorted it. I also added some of the unambiguous ones you listed. Free to take another look?

@elijah-potter elijah-potter added this pull request to the merge queue May 21, 2026
Merged via the queue into master with commit e2aa504 May 21, 2026
13 checks passed
@elijah-potter elijah-potter deleted the feature/contractions branch May 21, 2026 15:53
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.

2 participants