Skip to content

Conversation

@hippietrail
Copy link
Collaborator

Issues

N/A

Description

  • Provides a module that handles irregular verbs.
  • Adds a JSON file listing known irregular verbs.
  • JSON file supports comments as strings to note why certain words are omitted, etc.
  • JSON loading code is copied as closely as possible from the way that dictionary.dict and annotations.json are loaded.
  • Comes with a converted SimplePastToPastParticiple linter that uses it.
  • Will also be used with the in-progress WillNonLemma (feat: will ran → will run / ran work in progress #2268) and ExtraneousDidPast linters.
  • Will provide a model for implementing a similar module for irregular noun plurals.

How Has This Been Tested?

Unit tests are included for the one API so far needed.

Checklist

  • I have performed a self-review of my own code
  • I have added tests to cover my changes

Copy link
Collaborator

@elijah-potter elijah-potter left a comment

Choose a reason for hiding this comment

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

Overall, I love this refactor. I just have a few comments related to discoverability. Thanks!

@@ -0,0 +1,120 @@
use lazy_static::lazy_static;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This module is not directly related to linting. Could we instead move it next to the dictionary or perhaps simply higher up in the hierarchy?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Most of the dictionary/annotation/metadata logic seems to be in /src/ with some in /spell/. Since the latter would definitely be wrong I moved irregular_verbs.rs to /src/ - and it's now joined by irregular_nouns.rs

@@ -0,0 +1,127 @@
[
"// comments can appear in the line before an entry",
Copy link
Collaborator

Choose a reason for hiding this comment

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

I adore the idea of having a dedicating file for this, similar to the dictionary. I'd like to centralize all data files, though. Would you mind moving this next to the dictionary.dict?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done. And there's also irregular_nouns.json now.

Copy link
Collaborator

@elijah-potter elijah-potter left a comment

Choose a reason for hiding this comment

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

This is so close. Love the addition of the noun stuff.

(*NOUNS).clone()
}

pub fn get_plural_for_singular(&self, singular: &str) -> Option<&str> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I expect that we'll want to eventually have versions of these plugins that accept and return char arrays. I think we're fine for now, but it's something to think about.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes I've been thinking of various things that can be added but adding when they're needed seems pragmatic.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes I've been thinking of various things that can be added but adding when they're needed seems pragmatic.

Ok(Self { verbs })
}

pub fn get() -> Arc<Self> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we name this function similarly to the curated dictionary's equivalent?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I did start with the same curated() which I didn't think made sense for this. But then again they are actually curated!

pub mod expr;
mod fat_token;
mod ignored_lints;
pub mod irregular_nouns;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's just export the structs directly. Having the extra layer of indirection is redundant.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Let's just export the structs directly. Having the extra layer of indirection is redundant.

At first I wasn't sure what this meant, and neither was the LLM. But have a look - I think I got it how you want it.

Copy link
Collaborator

@elijah-potter elijah-potter left a comment

Choose a reason for hiding this comment

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

Looks good. Thanks!

@elijah-potter elijah-potter added this pull request to the merge queue Dec 8, 2025
Merged via the queue into Automattic:master with commit 66f3e84 Dec 8, 2025
11 checks passed
@hippietrail hippietrail deleted the irregular-verbs branch December 8, 2025 17:19
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