drahnr / cargo-spellcheck

Checks all your documentation for spelling and grammar mistakes with hunspell and a nlprule based checker for grammar
Apache License 2.0
320 stars 33 forks source link

Handle Snake_Case: Treat Underscore (and Hyphen) as white space #332

Closed crjeder closed 3 months ago

crjeder commented 3 months ago

Names for e. g. variables could be written in snake case. For the purpose of spellchecking Hyphen ("-") and Underscore ("_") should be treated as word separator.

set_mode();

is not an accepted word, but set and modewould be.

Interpreting snake case correctly would reduce the amount of false positives.

crjeder commented 3 months ago

That's the error message I am getting:

    |
 69 |  Set channel and gain with the set_mode() function.
    |                                ^^^^^^^^
    | - stomodeum
    |
    |   Possible spelling mistake found.
crjeder commented 3 months ago

Did a bit more testing. Seems this only happens in documentation comments ("///")

crjeder commented 3 months ago

code line is:

/// Set channel and gain with the set_mode() function.

repository: my hx711 driver

drahnr commented 3 months ago

Did you consider using back ticks for function calls? I think that'd be the appropriate common Mark context to use that is not spell checked.

drahnr commented 3 months ago

Also see #208 #329 which are taking a more holistic approach to the problem you outlined.

crjeder commented 3 months ago

jep, the workaround with the back ticks works for me. Thx!