Closed strickvl closed 1 year ago
@charliermarsh could we just port over typos, or is it too rust specific?
I think the best option would be to try and integrate typos as a library (https://docs.rs/typos/0.10.6/typos/). Not sure if the API is amenable to that.
(That is: call the typos functions directly in Rust, rather than using the CLI, and report typos as Ruff errors.)
I have been thinking about this for a while and I think we should keep spell checking separate from Ruff for the following reasons:
Yeah that makes sense. Let's pass on this for now.
I have been thinking about this for a while and I think we should keep spell checking separate from Ruff for the following reasons:
1. This spell checker is already blazingly fast, so users of typos have no reason to switch 2. Spell checkers do not need to parse python code, so we would not save any additional time from them being part of the library 3. Having to support multiple languages could be burdensome
Regarding 2, I think spell checkers can benefit greatly from parsing Python code.
For example, say I've installed a lib from PyPI that has typos on its function names. There's nothing I can do about them, they're outside my control, but I'll need to type the typos if I want to use these functions.
A normal spell checker, that treats everything as plain text, would see the typo and complain about it. But again, there's nothing I can do about them.
If the spell checker understands Python, it'll be able to tell what's my fault and what's outside my control, and so if the typo is on something from an external lib, it can ignore them, as I can't control that, but if the typo is on my own functions and variable names, it can then warn me.
There are seemingly two big Python code checkers:
pyspelling
andcodespell
. Codespell doesn't catch everything, and pyspelling is slow to run. It'd be great to have a version / implementation of the logic of these (eventually including PySpelling's exception syntax etc) inruff
.