False positives
dhardy opened this issue · comments
Hey, nice crate!
On applying this (see kas-gui/kas-text#62), I had to add a custom dictionary (it would be nice if this were easier, and if entries could be added directly from the "cargo fix" interactive CLI).
But the reason I opened this is due to several unexpected cases that are reported:
error: spellcheck(NlpRules)
--> /home/dhardy/projects/kas/text/src/env.rs:70
|
70 | Glyphs outside of these bounds may not be drawn.
| ^^^^^^^^^^
(2/2) Apply this suggestion [y,n,q,a,d,j,e,?]?
» outside
`outside of`
error: spellcheck(NlpRules)
--> /home/dhardy/projects/kas/text/src/display.rs:223
|
223 | Find the text index nearest horizontal-coordinate `x` on `line`
| ^^^
(1/1) Apply this suggestion [y,n,q,a,d,j,e,?]?
» online
`on `
error: spellcheck(NlpRules)
--> /home/dhardy/projects/kas/text/src/fonts/mod.rs:62
|
62 | Warning: on MacOS and Apple systems, a *point* sometimes refers to a
| ^^^^^
(4/4) Apply this suggestion [y,n,q,a,d,j,e,?]?
» macOS
`MacOS`
error: spellcheck(Hunspell)
--> /home/dhardy/projects/kas/text/src/raster.rs:102
|
102 | Subjectively, readability and apparent quality is better up to around `dpem=18` (~13.5pt),
| ^^^
(2/2) Apply this suggestion [y,n,q,a,d,j,e,?]?
PT
5 pt
dpt
opt
apt
» pt
`5pt`
...
error: spellcheck(NlpRules)
--> /home/dhardy/projects/kas/text/src/text.rs:319
|
319 | Find the text index nearest horizontal-coordinate `x` on `line`
| ^^^
(1/1) Apply this suggestion [y,n,q,a,d,j,e,?]?
» online
`on `
Cases 1, 2 and 5 make no sense to me. (I wondered about non-ASCII spaces/invisible chars, but rewriting doesn't fix.)
Case 3, MacOS
, was added to the dictionary, yet still comes up.
Case 4 may not be a bug, but I'm not sure if there's some way of handling numeric suffixes?
NlpRules
is expected to be noisy, the next version will disable it by default and stick with hunspell
only. You can get the same behavior with --checkers=hunspell
, which is more appropriate for CI. If you have code tags they will be elipsized before being fed to nlprules
, hence the high false-positive rate.
The dictionary is only relevant for hunspell, so nlprules is not affect - but it should not outline spelling mistakes anyways 🧐 So this is a bug.
Numeric suffixes can be handled with project specific quirks, if you find this is generalizable pattern, happy to add a builtin flag for this.
Regarding, interactive dictionary additions, #41 tracks that.
As always, happy to review incoming PRs :)