All Projects → drahnr → Cargo Spellcheck

drahnr / Cargo Spellcheck

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

Programming Languages

rust
11053 projects
grammar
57 projects

Projects that are alternatives of or similar to Cargo Spellcheck

Cargo C
build and install C-compatible libraries
Stars: ✭ 196 (+7.1%)
Mutual labels:  hacktoberfest, cargo
Tarpaulin
A code coverage tool for Rust projects
Stars: ✭ 1,097 (+499.45%)
Mutual labels:  hacktoberfest, cargo
Cargo Deny
❌ Cargo plugin for linting your dependencies 🦀
Stars: ✭ 533 (+191.26%)
Mutual labels:  hacktoberfest, cargo
Stegbrute
Fast Steganography bruteforce tool written in Rust useful for CTF's
Stars: ✭ 134 (-26.78%)
Mutual labels:  hacktoberfest, cargo
Rustfix
Automatically apply the suggestions made by rustc
Stars: ✭ 586 (+220.22%)
Mutual labels:  hacktoberfest, cargo
Cargo About
📜 Cargo plugin to generate list of all licenses for a crate 🦀
Stars: ✭ 148 (-19.13%)
Mutual labels:  hacktoberfest, cargo
Profile Command
Quickly identify what's slow with WordPress
Stars: ✭ 180 (-1.64%)
Mutual labels:  hacktoberfest
Circe
Yet another JSON library for Scala
Stars: ✭ 2,223 (+1114.75%)
Mutual labels:  hacktoberfest
Vue Highlight.js
📜 Highlight.js syntax highlighter component for Vue.
Stars: ✭ 180 (-1.64%)
Mutual labels:  hacktoberfest
Pluto
An x86 kernel written in Zig
Stars: ✭ 172 (-6.01%)
Mutual labels:  hacktoberfest
Git S3 Push
Deploy your git repo to an S3 bucket
Stars: ✭ 182 (-0.55%)
Mutual labels:  hacktoberfest
Thunder
An open-source game engine is written in C++ with a flexible architecture
Stars: ✭ 182 (-0.55%)
Mutual labels:  hacktoberfest
Fluentassertions
A very extensive set of extension methods that allow you to more naturally specify the expected outcome of a TDD or BDD-style unit tests. Targets .NET Framework 4.7, .NET Core 2.1 and 3.0, as well as .NET Standard 2.0 and 2.1. Supports the unit test frameworks MSTest2, NUnit3, XUnit2, MSpec, and NSpec3.
Stars: ✭ 2,449 (+1238.25%)
Mutual labels:  hacktoberfest
Nlp profiler
A simple NLP library allows profiling datasets with one or more text columns. When given a dataset and a column name containing text data, NLP Profiler will return either high-level insights or low-level/granular statistical information about the text in that column.
Stars: ✭ 181 (-1.09%)
Mutual labels:  hacktoberfest
Python Neo
Neo is a package for representing electrophysiology data in Python, together with support for reading a wide range of neurophysiology file formats
Stars: ✭ 180 (-1.64%)
Mutual labels:  hacktoberfest
Docker
Composer in Docker
Stars: ✭ 180 (-1.64%)
Mutual labels:  hacktoberfest
Hacktoberfest Data Structure And Algorithms
A repo to contains data structure s and algorithms, regardless of language.
Stars: ✭ 182 (-0.55%)
Mutual labels:  hacktoberfest
Pswriteword
PSWriteWord is powershell module to create Microsoft Word documents without Microsoft Word installed...
Stars: ✭ 180 (-1.64%)
Mutual labels:  hacktoberfest
Json C
https://github.com/json-c/json-c is the official code repository for json-c. See the wiki for release tarballs for download. API docs at http://json-c.github.io/json-c/
Stars: ✭ 2,313 (+1163.93%)
Mutual labels:  hacktoberfest
Zoo For Zotero
This is an Android app for viewing Zotero libraries.
Stars: ✭ 181 (-1.09%)
Mutual labels:  hacktoberfest

cargo-spellcheck

crates.io CI commits-since Check your spelling with hunspell and/or languagetool.

Use Cases

Run cargo spellcheck --fix or cargo spellcheck fix to fix all your documentation comments in order to avoid nasty 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 specific lingo.

Check For Spelling and/or Grammar Mistakes

cargo spellcheck check
error: spellcheck
   --> src/main.rs:44
    |
 44 | Fun facets shalld cause some erroris.
    |            ^^^^^^
    | - shall or shall d
    |

Apply Suggestions Interactively

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

Continuous Integration / CI

cargo spellcheck can be configured with -m <code> to return a non-zero return code if mistakes are found instead of 0.

git pre-commit hook

#!/usr/bin/sh

# Redirect output to stderr.
exec 1>&2

exec cargo spellcheck -m 99 $(git diff-index --cached --name-only --diff-filter=AM HEAD)

Implemented Features + Roadmap

  • [x] Parse doc comments from arbitrary files
  • [x] Decent error printing
  • [x] cargo-spellcheck check
  • [x] Spell checking using hunspell
  • [x] Merge multiline doc comments
  • [x] Handle multiline and fragmented mistakes (i.e. for grammar) #25
  • [x] Grammar check using languagetool http API
  • [x] Follow module declarations rather than blindly recurse
  • [x] Be commonmark/markdown aware
    • [ ] Handle doc-tests with ```rust as virtual files #43
    • [ ] Verify all types of links #44
  • [x] Check README.md files #37
  • [x] Improve interactive user interface with crossterm
  • [x] Ellipsize overly long statements with ... #42
  • [ ] Learn topic lingo and filter false-positive-suggestions #41
  • [x] Handle cargo workspaces #38
  • [x] Re-flow doc comments #39
  • [x] Collect dev comments as well #115

hunspell and languagetool are currently the two supported featuresets.

Configuration

# Project settings where a Cargo.toml exists and is passed
# ${CARGO_MANIFEST_DIR}/.config/spellcheck.toml

# Also take into account developer comments
dev_comments = false

# Skip the README.md file as defined in the cargo manifest
skip_readme = false

# Fallback to per use configuration files:
# Linux:   /home/alice/.config/cargo_spellcheck/config.toml
# Windows: C:\Users\Alice\AppData\Roaming\cargo_spellcheck\config.toml
# macOS:   /Users/Alice/Library/Preferences/cargo_spellcheck/config.toml
[LanguageTool]
url = "127.0.0.1:8010"

[Hunspell]
# lang and name of `.dic` file
lang = "en_US"
# OS specific additives
# Linux: [ /usr/share/myspell ]
# Windows: []
# macOS [ /home/alice/Libraries/hunspell, /Libraries/hunspell ]

# Additional search paths, which take presedence over the default
# os specific search dirs, searched in order, defaults last
# search_dirs = []

# Adds additional dictionaries, can be specified as
# absolute paths or relative in the search dirs (in this order).
# Relative paths are resolved relative to the configuration file
# which is used.
# Refer to `man 5 hunspell`
# or https://www.systutorials.com/docs/linux/man/4-hunspell/#lbAE
# on how to define a custom dictionary file.
extra_dictionaries = []

[Hunspell.quirks]
# Transforms words that are provided by the tokenizer
# into word fragments based on the capture groups which are to
# be checked.
# If no capture groups are present, the matched word is whitelisted.
transform_regex = ["^'([^\\s])'$", "^[0-9]+x$"]
# Accepts `alphabeta` variants if the checker provides a replacement suggestion
# of `alpha-beta`.
allow_concatenation = true
# And the counterpart, which accepts words with dashes, when the suggestion has
# recommendations without the dashes. This is less common.
allow_dashed = false

[NlpRules]
# Allows the user to override the default included
# exports of LanguageTool, with other custom
# languages

# override_rules = "/path/to/rules_binencoded.bin"
# override_tokenizer = "/path/to/tokenizer_binencoded.bin"

[Reflow]
# Reflows doc comments to adhere to adhere to a given maximum line width limit.
max_line_length = 80

To increase verbosity add -v (multiple) to increase verbosity.

Installation

cargo install cargo-spellcheck

Checkers

Available checker support

Hunspell

Requires a C++ compiler to compile the hunspell CXX source files which are part of hunspell-sys

Fedora 30+
dnf install -y clang
Ubuntu 19.10+
apt install -y clang
Mac OS X
brew install llvm

The environment variable LLVM_CONFIG_PATH needs to point to llvm-config, to do so:

export LLVM_CONFIG_PATH=/usr/local/opt/llvm/bin/llvm-config

NlpRules

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.

LanguageTool

Deprecated!

You must run an instance of the LanguageTool server i.e. as container.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].