Skip to content

typos identified by github.com/crate-ci/typos#3045

Merged
drgrice1 merged 1 commit into
openwebwork:WeBWorK-2.21from
Alex-Jordan:typos-ContentGenerator
Jul 11, 2026
Merged

typos identified by github.com/crate-ci/typos#3045
drgrice1 merged 1 commit into
openwebwork:WeBWorK-2.21from
Alex-Jordan:typos-ContentGenerator

Conversation

@Alex-Jordan

Copy link
Copy Markdown
Contributor

These are the typos from lib/WeBWorK/ContentGenerator/. There are not as many as I thought. Maybe when I did an initial count there was something wrong with the sytnax I used.

In a few places, things like variable names are changed. I believe they are changed consistently over their scope and the changes should cause no trouble. But they will lighten future scans for typos.

@drgrice1 drgrice1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this is okay.

I have done some testing with crate-ci/typos, and have concluded that it would not be a good idea to enable it as a work flow. In testing both with the webwork2 and PG code as well as with several other projects, I am seeing way to many false positives. So I don't think it would actually be safe to use in automated checking. It is fine to use it manually though.

push @{ $mlt{$mltind} }, $index;
} else {
$mlt{$mltind} = [$indx];
$mlt{$mltind} = [$index];

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would say that technically this is a false positive. I suspect this was an intended short form of the $index used for the variable name. This is caught by crate-ci/typos, but $subindx below is not, and that variable was spelled that way, I think clearly, for the same reason.

In any case, if this is changed, then $subindx below should also be changed for consistency.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is one that I almost left alone. But I just liked the readability of index over indx. I could have added it to the _typos.toml file but I opted to replace it here. I missed subindx though. I'll get to that.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

But that is part of my issue with the whitelist. I don't think that indx should be whitelisted. In general, it would be better for the variable here to be named $index and not $indx, but it is well established that I don't like abbreviations, and some other developers do like to abbreviate.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I agree. That's why I changed it to index instead of adding it to my local whitelist. But I am good with just making this a new annual thing, reviewing for typos this way. It's similar (but not quite as automated) as when you run the localizations.

I'm about to go change subindx too.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

s/subindx/subindex/ completed

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think that if you (or someone) were to get a configuration setup that works okay, then it wouldn't hurt to try a workflow. The worst case scenario we decide it is isn't good and remove it.

@Alex-Jordan

Copy link
Copy Markdown
Contributor Author

Did you see how to whitelist false positives? When building up these PRs, I had a _typos.toml file. I'm not pushing for this, just want to point out that possibility. That the repo would have a _typos.toml file, and new entries would need to be added occasionally to that file.

@drgrice1

Copy link
Copy Markdown
Member

Yeah, but that seems like it would be tedious to maintain.

For instance, crate-ci/typos sees the variable $pn in templates/ContentGenerator/GatewayQuiz.html.ep, and says that should be on. So would you whitelist pn? There are numerous cases of two letter variable names like that that it says should be changed.

In the file templates/ContentGenerator/Instructor/Scoring.html.ep it sees the string ful and say it should be full (but yet it ignores the other string scr there). You wouldn't want to whitelist ful.

In the file bin/OPLUtils.pm there is a writeJSONtoFile method. crate-ci/typos says that should be writeJSONNotFile. Perhaps the method could be better named with camel case, but it is not an entirely invalid way to name the method.

In other projects I saw some really dangerous things that it was making suggestions for. For example, one project has a list of YouTube video ids, and it was suggesting changes to parts of those.

In general, I think that using it for manual and double checked spell checking is good, and in fact I have enabled it as a language server in vim to get spell checking there.

@Alex-Jordan Alex-Jordan force-pushed the typos-ContentGenerator branch from 9fb9546 to cf77a85 Compare July 10, 2026 04:13
@drgrice1 drgrice1 merged commit 772fc03 into openwebwork:WeBWorK-2.21 Jul 11, 2026
2 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.

3 participants