Skip to content

Commit e75b41f

Browse files
drgrice1claude
andcommitted
Add a workflow for checking spelling.
A few more typos in the code were fixed. Note that the typo in the `htdocs/library-tree.json` was fixed. We don't actually use that file anymore anyway. The following code changes were made so that the words involved do not need to be blanket ignored. The weren't good variable names anyway. * The variable `$pn` in `templates/ContentGenerator/GatewayQuiz.html.ep` was renamed to `$problemNumber`. * The variable `%visibles` in `lib/WeBWorK/Utils/FilterRecords.pm` was renamed to `%visibleSets`. * The wording `select alls` was changed to `select all checkboxes` in the comments in `htdocs/js/SelectAll/selectall.js`. crate-ci/typos is configured via the .typos.toml file with tightly scoped extend-identifiers/extend-ignore-re entries for the remaining legitimate non-dictionary terms (crypted, DNE, ANDed, LANGuage, etc.) so the checker stays useful for catching real future typos. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
1 parent dbab4bb commit e75b41f

9 files changed

Lines changed: 90 additions & 21 deletions

File tree

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Check Spelling
3+
4+
on:
5+
push:
6+
branches-ignore: [main, develop]
7+
pull_request:
8+
9+
env:
10+
CLICOLOR: 1
11+
12+
jobs:
13+
spelling:
14+
name: Spell Check with crate-ci/typos
15+
runs-on: ubuntu-24.04
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v6
19+
- name: Spell check code
20+
uses: crate-ci/typos@v1.50.1

.typos.toml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
[files]
2+
extend-exclude = [
3+
"lib/WeBWorK/Localize/*",
4+
# Filename is fixed asset content, not text to correct.
5+
"courses.dist/modelCourse/html/achievements/2nd_order_ode.png",
6+
]
7+
8+
[default]
9+
extend-ignore-re = [
10+
# Intentional "(mis)coded" wordplay in AccessibilityGuide.md.
11+
'\(mis\)coded',
12+
# Abbreviation for "full", paired with "scr" (score), in scoring file
13+
# suffixes/labels.
14+
'ful\.csv',
15+
"'scr', 'ful'",
16+
'e\.g\. ful',
17+
# "Does Not Exist" notation in the MathJax AsciiMath symbol table.
18+
'dne: \{',
19+
'Dne: \{',
20+
'DNE: \{',
21+
"output: 'DNE'",
22+
]
23+
24+
# Each entry below is scoped to one exact identifier/token (case-sensitive,
25+
# whole-match only) rather than a global word, so it won't suppress a
26+
# genuine future typo that merely happens to contain the same fragment.
27+
[default.extend-identifiers]
28+
# Password-hashing naming convention used throughout (cryptedPassword,
29+
# crypted_password, etc.), not a typo of "encrypted".
30+
crypted = "crypted"
31+
crypted_ = "crypted_"
32+
cryptedPassword = "cryptedPassword"
33+
crypted_password = "crypted_password"
34+
# Variable name for the paired select-all checkboxes.
35+
pairedSelectAlls = "pairedSelectAlls"
36+
# Function name (write JSON to file).
37+
writeJSONtoFile = "writeJSONtoFile"
38+
# From "ANDed" (logically AND-ed together).
39+
ANDed = "ANDed"
40+
# From "LANGuage", deliberately styled to highlight the LANG env var.
41+
LANGuage = "LANGuage"
42+
# Placeholder value in docker-config/env.dist.
43+
sqlRootPasswordSetThisPasswordBEFOREfirstStartingTheDBcontainer = "sqlRootPasswordSetThisPasswordBEFOREfirstStartingTheDBcontainer"
44+
# Historical spelling preserved verbatim in the Artistic License text.
45+
MERCHANTIBILITY = "MERCHANTIBILITY"
46+
# IMS Caliper Analytics spec class name; must match the external spec exactly.
47+
FillinBlankResponse = "FillinBlankResponse"

doc/AccessibilityGuide.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,22 +110,22 @@ labels in a diagram, etc).
110110
graph — such as "Graph of y equals x squared" (default is "Graph"). When
111111
displaying the graph, the `alt` text is converted to an `aria_description`
112112
which has no character limit. An optional `long_description` can be added
113-
to give both a shorter `aria_descripition` and longer description.
113+
to give both a shorter `aria_description` and longer description.
114114

115115
- Descriptions of static images (`.png`, `.jpeg`, etc) are provided via the
116116
`alt` text. `alt` text should be short, under ~125 characters, since many
117117
screen readers may only read the first ~125 characters of the `alt` text.
118118
See the PGML help for syntax options to add `alt` text. For anything more
119119
complicated than a one-line description, provide both a short `alt` text
120-
and a full `long_descripition` of the image.
120+
and a full `long_description` of the image.
121121

122122
- Graphs created using the `PGlatex.pl`, `PGtikz.pl`, or `PGgraphmacros.pl`
123123
macros generate static images and follow the same guidelines as static
124124
images above. Graphs created using the deprecated `PGgraphmacros.pl` should
125125
migrate to using `plots.pl`. Consider also migrating images created using
126126
`PGlatex.pl` or `PGtikz.pl` to `plots.pl` as well.
127127

128-
- `long_descripition` can include more than a sentence or paragraph for
128+
- `long_description` can include more than a sentence or paragraph for
129129
the image. It can include data tables (for example, a table of (x, y)
130130
points a plotted curve passes through), and is included in both the HTML
131131
and hardcopy PDF output, and is visible for sighted users.
@@ -177,5 +177,5 @@ issue.
177177
[pg repository](https://github.com/openwebwork/pg/issues)
178178
- If the issue stems from how a specific problem was (mis)coded, please see
179179
section 3 of this guide. And if you improve the accessibility of the
180-
problem, contact your WeBWorK administrator to ask how you could contirubute
180+
problem, contact your WeBWorK administrator to ask how you could contribute
181181
the improvement upstream.

htdocs/js/SelectAll/selectall.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66
const checks = document.querySelectorAll(`input[name$=${selectAll.dataset.selectGroup}]`);
77

88
if (selectAll.type.toLowerCase() === 'checkbox') {
9-
// Find additional select alls in the same group if any.
9+
// Find additional select all checkboxes in the same group if any.
1010
const pairedSelectAlls = document.querySelectorAll(
1111
`.select-all[data-select-group="${selectAll.dataset.selectGroup}"]`
1212
);
1313

1414
selectAll.addEventListener('click', () => {
1515
checks.forEach((check) => (check.checked = selectAll.checked));
1616

17-
// Also check/uncheck any select alls in the same group.
17+
// Also check/uncheck any select all checkboxes in the same group.
1818
pairedSelectAlls.forEach((check) => (check.checked = selectAll.checked));
1919
});
2020

htdocs/library-tree.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

lib/WeBWorK/Utils/FilterRecords.pm

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,13 @@ sub getFiltersForClass {
123123
}
124124
}
125125
} elsif (ref $records[0] eq 'WeBWorK::DB::Record::Set') {
126-
my (%assignment_types, %visibles);
126+
my (%assignment_types, %visibleSets);
127127

128128
for my $set (@records) {
129129
++$assignment_types{ $set->assignment_type };
130-
++$visibles{ $set->visible }
131-
unless (defined $visibles{0} && $set->visible eq '' || defined $visibles{''} && $set->visible eq '0');
130+
++$visibleSets{ $set->visible }
131+
unless (defined $visibleSets{0} && $set->visible eq ''
132+
|| defined $visibleSets{''} && $set->visible eq '0');
132133
}
133134

134135
if (keys %assignment_types > 1 && (!%includes || $includes{assignment_type})) {
@@ -137,8 +138,8 @@ sub getFiltersForClass {
137138
}
138139
}
139140

140-
if (keys %visibles > 1 && (!%includes || $includes{visible})) {
141-
for my $vis (sortByName(undef, keys %visibles)) {
141+
if (keys %visibleSets > 1 && (!%includes || $includes{visible})) {
142+
for my $vis (sortByName(undef, keys %visibleSets)) {
142143
push @filters, [ ($vis ? $c->maketext('Visible') : $c->maketext('Not Visible')) => "visible:$vis" ];
143144
}
144145
}

lib/WeBWorK/WWSafe.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -790,7 +790,7 @@ called from a compartment but not compiled within it.
790790
791791
This evaluates the contents of file FILENAME inside the compartment.
792792
It uses the same rules as perl's built-in C<do> to locate the file,
793-
poossibly using C<@INC>.
793+
possibly using C<@INC>.
794794
795795
See above documentation on the B<reval> method for further details.
796796

templates/ContentGenerator/GatewayQuiz.html.ep

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -439,16 +439,16 @@
439439
%
440440
% # Set up links between problems and, for multi-page tests, pages.
441441
% for my $i (0 .. $#$pg_results) {
442-
% my $pn = $i + 1;
442+
% my $problemNumber = $i + 1;
443443
% content_for 'gw-navigation-problem-row' => begin
444444
<td class="problem">
445445
% if ($i >= $startProb && $i <= $endProb) {
446446
<%= link_to
447-
$pn => '#',
448-
class => 'problem-jump-link',
449-
data => { problem_number => $pn } =%>
447+
$problemNumber => '#',
448+
class => 'problem-jump-link',
449+
data => { problem_number => $problemNumber } =%>
450450
% } else {
451-
<%= $pn =%>
451+
<%= $problemNumber =%>
452452
% }
453453
</td>
454454
% end

templates/layouts/system.html.ep

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@
2828
const webworkConfig = <%== $c->webwork_js_config %>;
2929
</script>
3030
%
31-
% # JS Loads
32-
% # The color scheme JavaScript must be loaded early and not deferred to prevent flickering as the color scheme is set.
31+
% # JS Loads
32+
% # The color scheme JavaScript must be loaded early and not deferred
33+
% # to prevent flickering as the color scheme is set.
3334
<%= javascript $c->url({ type => 'webwork', name => 'htdocs', file => 'js/System/color-scheme.js' }) =%>
3435
<%= javascript $c->url({ type => 'webwork', name => 'htdocs', file => 'js/MathJaxConfig/mathjax-config.js' }),
3536
defer => undef =%>
@@ -182,7 +183,7 @@
182183
</nav>
183184
</div>
184185
</div>
185-
% # Navigation, e.g.: Prev, Up, Next for homeworks
186+
% # Navigation, e.g.: Prev, Up, Next for homework
186187
% if ($c->can('nav')) {
187188
<%= $c->nav({ style => 'buttons', separator => '' }) =%>
188189
% }

0 commit comments

Comments
 (0)