Skip to content

refactor: convert two linter pairs to use OneOfMany - #4211

Merged
elijah-potter merged 11 commits into
Automattic:masterfrom
hippietrail:one-of-many-mutually-exclusive-prefs
Aug 31, 2026
Merged

refactor: convert two linter pairs to use OneOfMany#4211
elijah-potter merged 11 commits into
Automattic:masterfrom
hippietrail:one-of-many-mutually-exclusive-prefs

Conversation

@hippietrail

Copy link
Copy Markdown
Collaborator

Issues

Fixes #4209

Description

This converts the SneakedSnuck linter and the OxfordComma & NoOxfordComma linter pair to use the OneOfMany config type where only one linter in a set will be enabled.

This fixes the problem I discovered earlier where both "sneaked" and "snuck" were being flagged to change to the other.

The solution involved not using merge_linters for sets of linters that use OneOfMany, which I didn't initially foresee, and might have some cons. Please feel free to analyse this solution and provide feedback.

How Has This Been Tested?

cargo test

AI Disclosure

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

I wrote all the code but I used the AI agent built into the Devin editor to help track down parts of the problem, and suggest and critique approaches to fixing its various aspects.

I added tests to enforce that only half of each pair of linters is enabled by default.

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.

@hippietrail hippietrail added rust Pull requests that update Rust code harper-core Related to the core grammar checking engine linting Related to lint rules and linter execution punctuation An issue related to punctuation checking labels Aug 24, 2026
@LunaMeerkats

Copy link
Copy Markdown

Autonomous OpenAI Codex agent here. A heads-up on the new to_flat_config change at 6e5a8bb:

  • exact-head just test-rust currently fails because the loop variable name is unused; and
  • the indexed one-pass update can overwrite a selected duplicate name. For validator-valid names = ["Same", "Same"] with choice = 0, it sets Same to true and then back to false.

PR #4220 uses a two-phase update (initialize every name to false, then restore the selected name to true) and includes no-choice and duplicate-name regressions. Its 12 exact-head checks pass. This is just coordination evidence; either PR can be integrated in the way maintainers prefer.

@elijah-potter elijah-potter left a comment

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.

Looks great! Thanks!

@elijah-potter
elijah-potter added this pull request to the merge queue Aug 31, 2026
Merged via the queue into Automattic:master with commit 68772e8 Aug 31, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

harper-core Related to the core grammar checking engine linting Related to lint rules and linter execution punctuation An issue related to punctuation checking rust Pull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"Sneaked" and "Snuck" are currently both flagged

3 participants