Skip to content

Fix as many spelling mistakes as possible#572

Open
ernstki wants to merge 2 commits into
Nitrokey:mainfrom
ernstki:spelling-fixes
Open

Fix as many spelling mistakes as possible#572
ernstki wants to merge 2 commits into
Nitrokey:mainfrom
ernstki:spelling-fixes

Conversation

@ernstki
Copy link
Copy Markdown

@ernstki ernstki commented Apr 27, 2026

  • adds a new dependency for spell checking as part of the Sphinx build process: sphinxcontrib-spelling
  • adds two new Makefile targets: check-spelling and fix-spelling (fix-spelling works best with the Vim editor)

You can run the Make targets like this:

# interactively update local wordlist and open $EDITOR to fix misspellings
make spell && make fix

# skip updating the local wordlist with new (mis)spellings
make spell SKIP_ADD_SPELLINGS=1 && make fix

@ernstki
Copy link
Copy Markdown
Author

ernstki commented Apr 27, 2026

As a reader of the docs, I noticed a few misspellings, but there ended up being more than I could fix by hand, so I went looking for tools to help. I started out using Vale, but decided on sphinxcontrib-spelling in the end, since the format of the config file (conf.py) is already familiar.

If you, the maintainers, are not happy with my use of sphinxcontrib-spelling's spelling:word-list directive to create per-file word lists, I'm happy to collapse all those into the top-level wordlist.txt instead.

It seemed inadvisable to do so with words that seemed likely to be actual misspellings or mis-capitalizations elsewhere, like sys and usb, which is why I didn't.

@ernstki ernstki force-pushed the spelling-fixes branch 6 times, most recently from 6ed2d60 to f6f0458 Compare April 27, 2026 05:48
@jans23
Copy link
Copy Markdown
Member

jans23 commented Apr 27, 2026

Thank you for your contribution. That approach is much appreciated. We will take a closer look soon and come back here.

@daringer
Copy link
Copy Markdown
Contributor

I am impressed how many typos and spelling errors we've generated - thanks for the effort ... this really looks pretty good - could you please separate the implementation from the actual spelling fixes - then I'd say LGTM.

@ernstki
Copy link
Copy Markdown
Author

ernstki commented Apr 27, 2026

I am impressed how many typos and spelling errors we've generated - thanks for the effort ... this really looks pretty good - could you please separate the implementation from the actual spelling fixes - then I'd say LGTM.

You all are writing code and building products and working in two languages, so no judgements from me. I'm happy to be able to help.

Is the "implementation" part actually a useful contribution (to submit as a second PR), or… should I simply elide those Makefile modifications altogether? No hard feelings either way.

@daringer
Copy link
Copy Markdown
Contributor

Thanks, for the kind words :D
I don't think there is need for another PR, I'd just like to have a commit which I can easily identify which does the actual "implementation" (Makefile stuff, conf.py, req.txt ...) and one for the actual spelling fixes

@ernstki ernstki force-pushed the spelling-fixes branch 2 times, most recently from 3c5e907 to 416cf9c Compare May 1, 2026 00:43
These two new Makefile targets allow you to:

- identify potential misspellings with sphinxcontrib-spelling[1]
- (optionally) add them to a custom word list, and
- loop through all the misspelled files, opening them with your $EDITOR.

Run `make check-spelling` (alias: `spell`) to start the process,
followed by `make fix-spelling` (aliases: `fix` or `correct`).

A list of _correct_ spellings (which will not be flagged by the Sphinx
extension) is contained in `wordlist.txt`. The `check-spelling` target
gives you the opportunity to update this word list if new (putative)
misspellings are identified.

The `fix-spelling` target works best with Vim/Neovim. It employs the
`hlsearch` and quickfix features to make it easier to find and correct
spelling mistakes in the individual source files.

For other editors, the misspelled file and the list of misspellings
identified by sphinxcontrib-spelling are simply passed as command-line
arguments.

[1]: https://sphinxcontrib-spelling.readthedocs.io
ernstki added a commit to ernstki/nitrokey-documentation that referenced this pull request May 1, 2026
Uses the `make fix-spelling` target introduced by PR Nitrokey#572
Comment thread source/conf.py

spelling_word_list_filename = '../wordlist.txt'
#spelling_show_suggestions = True
spelling_exclude_patterns = ['**/api/*']
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I have excluded the /api subpath for now; it would've been a lot of work, since many of the headings were "misspellings" due to their being API methods and such.

@ernstki ernstki marked this pull request as draft May 1, 2026 01:41
Uses the `make fix-spelling` target introduced by PR Nitrokey#572
@ernstki
Copy link
Copy Markdown
Author

ernstki commented May 1, 2026

I'd just like to have a commit which I can easily identify which does the actual "implementation" (Makefile stuff, conf.py, req.txt ...) and one for the actual spelling fixes

@daringer OK, this is done.

I would welcome feedback about how useful you think the Vim parts will actually be. If no one on your team uses that editor, then those parts of the Makefile are probably just a maintenance liability.

The commit message for ac07841 describes the process I used. I have also updated the README (locally) with the same information, but I'll do that in a separate PR, once this is merged, if that's okay.

@ernstki ernstki marked this pull request as ready for review May 2, 2026 02:13
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