drahnr / cargo-spellcheck

Checks all your documentation for spelling and grammar mistakes with hunspell and a nlprule based checker for grammar

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Citations written as "[number]" are spuriously detected as typos

ssokolow opened this issue · comments

Describe the bug

I have various pieces of information where I put a note of the form [1] inline or at the end to indicate the source being cited. Currently, each of these gets detected as a typo, making cargo-spellcheck completely impractical to run more often or automatically than "once before spinning a release".

To Reproduce

Steps to reproduce the behaviour:

  1. Have a file containing a hyperlink with [1] or [2] or the like as the text in the documentation.
  2. Run cargo spellcheck check

Expected behavior

A word that matches \[\d+\] after handling escapes should not be considered a typo.

Screenshots

error: spellcheck(Hunspell)
    --> /home/ssokolow/src/rust-cli-boilerplate/cli_validators/src/path.rs:838
     |
 838 |    [\[1\]](https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#naming-conventions)
     |      ^^
     |   Possible spelling mistake found.

error: spellcheck(Hunspell)
    --> /home/ssokolow/src/rust-cli-boilerplate/cli_validators/src/path.rs:847
     |
 847 |     [\[2\]](http://www.catb.org/esr/writings/taoup/html/ch10s05.html)
     |       ^^
     |   Possible spelling mistake found.

error: spellcheck(Hunspell)
    --> /home/ssokolow/src/rust-cli-boilerplate/cli_validators/src/path.rs:848
     |
 848 |     [\[3\]](http://tldp.org/LDP/abs/html/standard-options.html)
     |       ^^
     |   Possible spelling mistake found.

error: spellcheck(Hunspell)
    --> /home/ssokolow/src/rust-cli-boilerplate/cli_validators/src/path.rs:850
     |
 850 |     [\[4\]](http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html)
     |       ^^
     |   Possible spelling mistake found.

error: spellcheck(Hunspell)
    --> /home/ssokolow/src/rust-cli-boilerplate/cli_validators/src/path.rs:870
     |
 870 |     [\[5\]](https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file)
     |       ^^
     |   Possible spelling mistake found.

error: spellcheck(Hunspell)
    --> /home/ssokolow/src/rust-cli-boilerplate/cli_validators/src/path.rs:875
     |
 875 |       [\[6\]](https://www.boost.org/doc/libs/1_36_0/libs/filesystem/doc/portability_guide.htm)
     |         ^^
     |   Possible spelling mistake found.

Please complete the following information:

  • System: Kubuntu Linux 20.04.3 LTS
  • Obtained: cargo
  • Version: cargo-spellcheck 0.9.0

Thanks for reporting, this seems to be an issue with some added quirks in the segmenters that are too zealous and always split pre ] - could you provide me your spellcheck config file, if any? Thanks

Here you go. Nothing fancy.

[Hunspell]
search_dirs = ["."]
extra_dictionaries = ["custom.dic"]

# Be consistent between my computer and CI systems
skip_os_lookups = true
use_builtin = true

Bit of a shame I couldn't just embed it in Cargo.toml to be honest.

Here are the contents of custom.dic in case you think any of these should be added to the builtins:

APIs
argh
booleans
bytestrings
canonicalize
CLI
codepoints
CreateFileW
CSV
deduplicating
DVDs
eCryptfs
eg
escaper
exFAT
FAT32
filename
filenames
filesystem
filesystems
Joliet
libc
mkisofs
murarth
namespaces
NTFS
parsers
POSIX
runtime
Serde
StructOpt
subprocess
TODO
TOCTTOU
UDF
UI
unescaper
unescaping
uppercasing
validator
validators
widechar
Win32