Check your spelling with
hunspell
and/or languagetool
.
Run cargo spellcheck --fix
or cargo spellcheck fix
to fix all your
documentation comments in order to avoid narsty typos all over your source tree.
Meant as a helper simplifying review as well as improving CI checks after a
learning phase for custom/topic specifc lingo.
zsh
cargo spellcheck check
error: spellcheck --> src/main.rs:44 | 44 | Fun facets shalld cause some erroris. | ^^^^^^ | - shall or shall d |
zsh
cargo spellcheck fix
error: spellcheck(Hunspell) --> /media/supersonic1t/projects/cargo-spellcheck/src/literalset.rs:291 | 291 | Returns literl within the Err variant if not adjacent | ^^^^^^ (13/14) Apply this suggestion [y,n,q,a,d,j,e,?]? lite litter litterer liter l liters literal liter ยป a custom replacement literal
cargo spellcheck
can be configured with -m <code>
to return a non-zero
return code if mistakes are found instead of 0
.
```sh
exec 1>&2
exec cargo spellcheck -m 99 $(git diff-index --cached --name-only --diff-filter=AM HEAD) ```
cargo-spellcheck check
hunspell
languagetool
http APIcommonmark
/markdown
aware
README.md
files #37crossterm
...
#42hunspell
and languagetool
are currently the two supported featuresets.
```toml
dev_comments = false
skip_readme = false
[LanguageTool] url = "127.0.0.1:8010"
[Hunspell]
.dic
filelang = "en_US"
man 5 hunspell
extra_dictionaries = []
[Hunspell.quirks]
transform_regex = ["^'([^\s])'$", "^[0-9]+x$"]
alphabeta
variants if the checker provides a replacement suggestionalpha-beta
.allow_concatenation = true
allow_dashed = false
[NlpRules]
[Reflow]
maxlinelength = 80 ```
To increase verbosity add -v
(multiple) to increase verbosity.
cargo install cargo-spellcheck
Available checker support
Requires a C++ compiler to compile the hunspell CXX source files which are part
of hunspell-sys
sh
dnf install -y clang
sh
apt install -y clang
sh
brew install llvm
The environment variable LLVM_CONFIG_PATH
needs to point to llvm-config
, to
do so:
sh
export LLVM_CONFIG_PATH=/usr/local/opt/llvm/bin/llvm-config
When compiled with the default featureset which includes nlprules
, the
resulting binary can only be distributed under the LGPLv2.1
since the rules
and tokenizer
definitions are extracted from LanguageTool
(which is itself licensed under LGPLv2.1
) as described by
the library that is used for pulling and integrating - details are to be found
under crate nlprule
's
README.md.
Deprecated!
You must run an instance of the LanguageTool server i.e. as container.