cargo-spellcheck icon indicating copy to clipboard operation
cargo-spellcheck copied to clipboard

Operators, arrows, dashes, units in documentation

Open dhardy opened this issue 3 months ago • 2 comments

Describe the bug

A selection of false positives in doc comments:

 15 |  Convert `usize` → `u32`
    |                  ^

 81 |  margin due to side bearings — though this could even be negative).
    |                              ^

 17 |  -   1 *Point* = 1/72 inch (~0.35mm), by the usual DTP standard
    |                ^

 17 |  -   1 *Point* = 1/72 inch (~0.35mm), by the usual DTP standard
    |                             ^

    |
 17 |  -   1 *Point* = 1/72 inch (~0.35mm), by the usual DTP standard
    |                                ^^^^

 17 |  ratio, typically in the 50% - 200% range.
    |                          ^^^
    |   Possible spelling mistake found.

Expected behavior

Characters like arrows and m-dashes should be supported.

Operators like =, ~ and % should be supported outside of code blocks.

Use of units like 0.35mm should be supported outside of code blocks.

Please complete the following information:

  • System: Fedora 42
  • Obtained: cargo install
  • Version: cargo-spellcheck 0.15.5

dhardy avatar Sep 08 '25 18:09 dhardy

I am very happy to support these, but it's difficult to strike a balance of character sets to allow and those to deny, it's oftentimes project specific. Depend strongly on external input. Technically these are fixable with regex exceptions, but I think there is a common set of i.e. SI suffixes that would be well suited to get their separate opt-out config value with default on.

drahnr avatar Sep 09 '25 07:09 drahnr

In terms of characters, I would advocate that the following should be allowed:

  • Everything under the "Arrows" blocks, including supplements (see https://www.unicode.org/charts/)
  • Everything under the "Mathematical Operators" blocks
  • Maybe also "Geometric Shapes"? Not sure about this.

Regarding suffixes, I don't think there's a clear-cut answer. One can peruse International System of Units but there are many ways of combining SI prefixes with units, only some of them being commonly used.

Then there are a few suffixes you won't find under SI units, for example 16px or 2em (both used for font sizing).

dhardy avatar Sep 09 '25 08:09 dhardy