Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a spell checker to find typos in *.rst files #10601

Closed
philderbeast opened this issue Nov 27, 2024 · 3 comments · Fixed by #10603
Closed

Use a spell checker to find typos in *.rst files #10601

philderbeast opened this issue Nov 27, 2024 · 3 comments · Fixed by #10603

Comments

@philderbeast
Copy link
Collaborator

Over the last few days I've stumbled on some typos in the *.rst docs and in haddocks. Could we check for typos in CI?

I've tried typos. It has a github action, typos-action, can be run locally and has configuration. Here it is finding typos in *.rst files.

$ typos **/*.rst
error: `informations` should be `information`
  --> doc/cabal-commands.rst:398:49
    |
398 | ``cabal info [FLAGS] PACKAGES`` displays useful informations about remote
    |                                                 ^^^^^^^^^^^^
    |
error: `spefic` should be `specific`
  --> doc/cabal-commands.rst:471:11
    |
471 | ask for a spefic one by adding version numbers
    |           ^^^^^^
    |
error: `reseved` should be `reserved`
  --> doc/cabal-commands.rst:1300:54
     |
1300 | - ``reserved-z-prefix``: package with ``z-`` prexif (reseved for Cabal.
     |                                                      ^^^^^^^
     |
error: `becuase` should be `because`
  --> doc/cabal-commands.rst:1387:61
     |
1387 | - ``glob-no-extension``: glob pattern not matching any file becuase of lack of extension matching (`cabal-version` < 2.4).
     |                                                             ^^^^^^^
     |
error: `executabes` should be `executables`
  --> doc/cabal-package-description-file.rst:1117:12
     |
1117 |  A list of executabes (possibly brought into scope by
     |            ^^^^^^^^^^
     |
error: `seperated` should be `separated`
  --> doc/cabal-package-description-file.rst:1124:47
     |
1124 |  build. They are expected to output a newline-seperated list of
     |                                               ^^^^^^^^^
     |
error: `informations` should be `information`
  --> doc/cabal-package-description-file.rst:3093:27
     |
3093 | Accessing package-related informations
     |                           ^^^^^^^^^^^^
     |
error: `executabes` should be `executables`
  --> doc/file-format-changelog.rst:42:14
   |
42 |   enumerates executabes (possibly brought into scope by  :pkg-field:`build-tool-depends`) that are run after all other
   |              ^^^^^^^^^^
   |
error: `managable` should be `manageable`, `manageably`
  --> doc/getting-started.rst:75:6
   |
75 | more managable building blocks.
   |      ^^^^^^^^^
   |
error: `parametrized` should be `parameterized`
  --> doc/how-to-use-backpack.rst:19:56
   |
19 | a package that defines some requirements.  To define a parametrized
   |                                                        ^^^^^^^^^^^^
   |
error: `parametrized` should be `parameterized`
  --> doc/how-to-use-backpack.rst:34:15
   |
34 |     :caption: parametrized.cabal
   |               ^^^^^^^^^^^^
   |
error: `parametrized` should be `parameterized`
  --> doc/how-to-use-backpack.rst:37:11
   |
37 |     name: parametrized
   |           ^^^^^^^^^^^^
   |
error: `parametrized` should be `parameterized`
  --> doc/how-to-use-backpack.rst:48:23
   |
48 | some way to apply the parametrized package with an implementation of
   |                       ^^^^^^^^^^^^
   |
error: `parametrized` should be `parameterized`
  --> doc/how-to-use-backpack.rst:54:39
   |
54 | module named ``Str``, instantiating ``parametrized`` is as simple as
   |                                       ^^^^^^^^^^^^
   |
error: `parametrized` should be `parameterized`
  --> doc/how-to-use-backpack.rst:55:43
   |
55 | just depending on both ``str-impl`` and ``parametrized``:
   |                                           ^^^^^^^^^^^^
   |
error: `parametrized` should be `parameterized`
  --> doc/how-to-use-backpack.rst:64:38
   |
64 |       build-depends: base, str-impl, parametrized
   |                                      ^^^^^^^^^^^^
   |
error: `parametrized` should be `parameterized`
  --> doc/how-to-use-backpack.rst:78:13
   |
78 |   ``mixins: parametrized requires (Str as Data.Text)``
   |             ^^^^^^^^^^^^
   |
error: `parametrized` should be `parameterized`
  --> doc/how-to-use-backpack.rst:94:46
   |
94 |       build-depends: base, text, bytestring, parametrized
   |                                              ^^^^^^^^^^^^
   |
error: `parametrized` should be `parameterized`
  --> doc/how-to-use-backpack.rst:96:9
   |
96 |         parametrized (MyModule as MyModule.Text) requires (Str as Data.Text),
   |         ^^^^^^^^^^^^
   |
error: `parametrized` should be `parameterized`
  --> doc/how-to-use-backpack.rst:97:9
   |
97 |         parametrized (MyModule as MyModule.BS) requires (Str as Data.ByteString)
   |         ^^^^^^^^^^^^
   |
error: `parametrized` should be `parameterized`
  --> doc/how-to-use-backpack.rst:100:1
    |
100 | parametrized libraries; :ref:`Sublibraries <sublibs>` can be used
    | ^^^^^^^^^^^^
    |

There are other options, such as GitHub Spellcheck Action.

@philderbeast
Copy link
Collaborator Author

It could also be run over *.hs files but this would likely need a lot of configuration.

$ typos Cabal/**/*.hs
...
error: `informations` should be `information`
  --> Cabal/src/Distribution/Simple/Build/PackageInfoModule.hs:13:39
   |
13 | -- enables them to find their package informations.
   |                                       ^^^^^^^^^^^^
   |
error: `informations` should be `information`
  --> Cabal/src/Distribution/Simple/BuildToolDepends.hs:16:54
   |
16 | -- | Same as 'desugarBuildTool', but requires atomic informations (package
   |                                                      ^^^^^^^^^^^^
   |
error: `synopsys` should be `synopsis`
  --> Cabal/src/Distribution/Simple/Command.hs:627:29
    |
627 | hiddenCommand (Command name synopsys f _cmdType) =
    |                             ^^^^^^^^
    |
error: `synopsys` should be `synopsis`
  --> Cabal/src/Distribution/Simple/Command.hs:628:16
    |
628 |   Command name synopsys f HiddenCommand
    |                ^^^^^^^^
    |
error: `Infomation` should be `Information`
  --> Cabal/src/Distribution/Simple/Compiler.hs:485:10
    |
485 |       -- Infomation about compiler ways is only accurately reported after
    |          ^^^^^^^^^^
    |
...

@ulysses4ever
Copy link
Collaborator

That's a cool stuff! I'm a little worried about false positives but not too much.

@philderbeast philderbeast changed the title Use a spell checker to find typos. Use a spell checker to find typos in *.rst files Nov 28, 2024
@ffaf1
Copy link
Collaborator

ffaf1 commented Nov 28, 2024

If it does not block CI or saddles people tending CI, why not.

@mergify mergify bot closed this as completed in #10603 Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants