Skip to content

Commit 697f857

Browse files
committed
Automatically check for typos with crate-ci/typos
1 parent 4d36f2c commit 697f857

File tree

6 files changed

+40
-3
lines changed

6 files changed

+40
-3
lines changed

.github/workflows/spelling.yml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Spelling
2+
3+
permissions:
4+
contents: read
5+
6+
on: [pull_request, push]
7+
8+
env:
9+
CLICOLOR: 1
10+
11+
jobs:
12+
spelling:
13+
name: Spell Check with Typos
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout Actions Repository
17+
uses: actions/checkout@v4
18+
- name: Spell Check Repo
19+
uses: crate-ci/[email protected]

Documentation/src/case-studies/calendar.md

+8
Original file line numberDiff line numberDiff line change
@@ -294,12 +294,16 @@ Why does that help us with the layout? To create the first line of our final lay
294294

295295
One of these chunks now looks like this:
296296

297+
<!-- spellchecker:off -->
298+
297299
```
298300
Januar | 1 2 3 4 5 | 6 7 8 9 10 11 12 | 13 14 15 16 17 18 19 | 20 21 22 23 24 25 26 | 27 28 29 30 31 |
299301
Februar | 1 2 | 3 4 5 6 7 8 9 | 10 11 12 13 14 15 16 | 17 18 19 20 21 22 23 | 24 25 26 27 28 29 |
300302
März | 1 | 2 3 4 5 6 7 8 | 9 10 11 12 13 14 15 | 16 17 18 19 20 21 22 | 23 24 25 26 27 28 29 | 30 31 |
301303
```
302304

305+
<!-- spellchecker:on -->
306+
303307
That actually already looks a lot like what we want, but we want the months on the top not on the left.
304308

305309
It also looks like a matrix, and on a matrix the operation to flip the rows and the columns (on a diagonal symmetry) is called transpose.
@@ -322,6 +326,8 @@ private static string CreateCalendarString(int year)
322326

323327
After this transforamtion our chunk of 3 months looks like this:
324328

329+
<!-- spellchecker:off -->
330+
325331
```
326332
Januar | Februar | März
327333
1 2 3 4 5 | 1 2 | 1
@@ -332,6 +338,8 @@ After this transforamtion our chunk of 3 months looks like this:
332338
| | 30 31
333339
```
334340

341+
<!-- spellchecker:on -->
342+
335343
I think it is obvious that at this point, we are done. We just have to join the chunks together to have our final output.
336344

337345
```cs

Funcky.Test/Extensions/ParseExtensionsTest.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ public static TheoryData<Option<bool>, string> BooleanStrings()
9494
{ Option<bool>.None, string.Empty },
9595
{ Option.Some(true), "true" },
9696
{ Option.Some(false), "false" },
97-
{ Option.Some(true), "TrUe" },
98-
{ Option.Some(false), "FalsE" },
97+
{ Option.Some(true), "TrUe" }, // spellchecker:disable-line
98+
{ Option.Some(false), "FalsE" }, // spellchecker:disable-line
9999
{ Option<bool>.None, "0" },
100100
{ Option<bool>.None, "1" },
101101
{ Option<bool>.None, "T" },

Funcky.Test/FunctionalClass/UncurryTest.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace Funcky.Test.FunctionalClass;
66
public sealed class UncurryTest
77
{
88
[Property]
9-
public Property GivenA2NdLevelCurriedFunctionWeGetAFunctionWith2Parameters(int number, string text)
9+
public Property GivenASecondLevelCurriedFunctionWeGetAFunctionWith2Parameters(int number, string text)
1010
{
1111
Func<int, Func<string, string>> f = number => text => $"number:{number}, text:{text}";
1212

Funcky.sln

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build Config", "Build Confi
2424
GlobalUsings.props = GlobalUsings.props
2525
GlobalUsings.Test.props = GlobalUsings.Test.props
2626
NuGet.config = NuGet.config
27+
typos.toml = typos.toml
2728
EndProjectSection
2829
EndProject
2930
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Funcky.Xunit", "Funcky.Xunit\Funcky.Xunit.csproj", "{F2E98B0D-CC17-4576-89DE-065FF475BE6E}"

typos.toml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[default]
2+
extend-ignore-re = [
3+
# Ignore the signature block in the `install.ps1` script
4+
"(?s)(#|//)\\s*SIG # Begin signature block.*?\\n\\s*(#|//)\\s*SIG # End signature block",
5+
# Line ignore with trailing `# spellchecker:disable-line`
6+
"(?Rm)^.*(#|//)\\s*spellchecker:disable-line$",
7+
# Line block with `# spellchecker:<on|off>`
8+
"(?s)(<!--|#|//)\\s*spellchecker:off.*?\\n\\s*(<!--|#|//)\\s*spellchecker:on",
9+
]

0 commit comments

Comments
 (0)